Mail Archives: cygwin/2005/01/06/09:53:41
>>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]
member.
>>(according to "The Open Group Base Specifications Issue 6 IEEE Std 1003.1,
2004
>>Edition")
>>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
than
>>the union itself.
>>
>>I had a glance at the cygwin source code (file: timer.cc)
>>
>> case SIGEV_THREAD:
>> {
>> pthread_t notify_thread;
>> debug_printf ("%p starting thread", x);
>> int rc = pthread_create (¬ify_thread,
>>tt.evp.sigev_notify_attributes,(void * (*) (void *))
>>tt.evp.sigev_notify_function,&tt.evp.sigev_value);
>>
>>The last argument: [&tt.evp.sigev_value] is probably wrong (passing an
address)
>
>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.
>
>cgf
>
>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 (¬ify_thread,
tt.evp.sigev_notify_attributes,
> (void * (*) (void *))
tt.evp.sigev_notify_function,
>- &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/
- Raw text -