timer_create / POSIX non conformance ?

claude.roblez@free.fr claude.roblez@free.fr
Thu Jan 6 14:54:00 GMT 2005

>>The problem appears with the [timer_create] function called with a [sigevent]
>>structure having its [sigev_notify] member set to [SIGEV_THREAD].
>>In this case, the function pointed to by the [sigev_notify_function] member is
>>prototyped [void(*)(union sigval)] and should receive the [sigev_value]
>>(according to "The Open Group Base Specifications Issue 6 IEEE Std 1003.1,
>>On various Linux systems (Debian, Fedora...), the behaviour is appropriate.
>>Under Cygwin, in order to perform correctly, I have to declare my function :
>static void SignalTimer(union sigval *sig)
>instead of : static void SignalTimer(union sigval sig).
>>Actually, the function receives a pointer to the sigev_value member rather
>>the union itself.
>>I had a glance at the cygwin source code (file: timer.cc)
>>	  {
>>	    pthread_t notify_thread;
>>	    debug_printf ("%p starting thread", x);
>>	    int rc = pthread_create (&notify_thread,
>>tt.evp.sigev_notify_attributes,(void * (*) (void *))
>>The last argument: [&tt.evp.sigev_value] is probably wrong (passing an
>I changed this code as per the patch below.  Thanks for pinpointing where it
>was going wrong.
>A snapshot is being generated even as I type.
>Index: timer.cc
>RCS file: /cvs/src/src/winsup/cygwin/timer.cc,v
>retrieving revision 1.3
>diff -u -p -r1.3 timer.cc
>--- timer.cc    26 Nov 2004 04:15:09 -0000      1.3
>+++ timer.cc    6 Jan 2005 14:08:03 -0000
>>@@ -133,7 +133,7 @@ timer_thread (VOID *x)
>            debug_printf ("%p starting thread", x);
>            int rc = pthread_create (&notify_thread,
>                                     (void * (*) (void *))
>-                                    &tt.evp.sigev_value);
>+                                    tt.evp.sigev_value.sival_ptr);
>            if (rc)
>              {
>                debug_printf ("thread creation failed, %E");

As far as I can see, the latest snapshot (2005-Jan-06) solves the problem
(extensive testing will follow).

Thank you for your incredibly fast reply and snapshot delivery.

Claude Roblez

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/

More information about the Cygwin mailing list