This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: timer_create / POSIX non conformance ?
- From: Christopher Faylor <cgf-no-personal-reply-please at cygwin dot com>
- To: cygwin at cygwin dot com
- Date: Thu, 6 Jan 2005 09:09:50 -0500
- Subject: Re: timer_create / POSIX non conformance ?
- References: <1105019442.41dd4232c0e7b@imp1-q.free.fr>
- Reply-to: cygwin at cygwin dot com
On Thu, Jan 06, 2005 at 02:50:42PM +0100, claude.roblez@free.fr wrote:
>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");
--
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/