delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/02/23/09:47:31

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
From: Gabi Davar <Gabid AT emblazesemi DOT com>
To: cygwin AT cygwin DOT com
Cc: corinna-cygwin AT cygwin DOT com
Message-ID: <403A12B6.8030008@emblazesemi.com>
Date: Mon, 23 Feb 2004 16:48:22 +0200
User-Agent: Mozilla Thunderbird 0.5 (Windows/20040207)
MIME-Version: 1.0
Subject: Re: PROBLEM - Signals not handled while waiting on semphores
References: <4039EF3F DOT 9070202 AT emblazesemi DOT com> <20040223124501 DOT GX1587 AT cygbert DOT vinschen DOT de>
In-Reply-To: <20040223124501.GX1587@cygbert.vinschen.de>
X-IsSubscribed: yes

Thanks for the quick reply, classic SysV semaphores do behave correctly 
with new dll.

unfortunately there are still problems -
* flag SA_RESTART passed to sigaction seem to be ignored ( see previous 
post for sample code )
* signals are not delivered when using POSIX named semaphores  (semaphore.h)

The following code reproduces the problem with cygwin1.dll & cygserv.exe 
from 2004-02-21

-gabi

==========================================================
    struct sigaction gintact;
  
    sem_t *sem;
    static int sem_count = 0;
    char sem_name[ 64 ];

    sprintf( sem_name, "/tmp/%d.%d", getpid(), sem_count++ );
   
    sem = sem_open( sem_name, O_CREAT, O_RDWR, 0 );
    if (sem == SEM_FAILED) {
        perror( "Failed to create sempahore" );
        return 1;
    }

    if (sigemptyset( &gintact.sa_mask ) < 0) {
        perror("Failed to initialize the signal mask");
        return 1;
    }

    gintact.sa_handler = &GIntHandler;
    gintact.sa_flags = SA_RESTART;

    if (sigaction( SIGUSR1, &gintact, NULL ) < 0) {
        perror("Failed to install the handler");
        return 1;
    }

    if (sem_wait(sem) == -1) {
        perror("Failed to lock semlock");
    }
    ...
Corinna Vinschen wrote:

>On Feb 23 14:17, Gabi Davar wrote:
>  
>
>>Hi,
>>
>>I'm unable to receive signals while waiting on semaphores. The following 
>>short program illustrates the problem. Sending SIGUSR1 when in semop 
>>does not result in "sig handler!!!" print.
>>    
>>
>
>That should be solved in CVS.  Try a recent cygwin snapshot from
>http://cygwin.com/snapshots/ Replace both, cygwin1.dll and cygserver.exe.
>
>Corinna
>
>  
>

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019