timer_create / POSIX non conformance ?

claude.roblez@free.fr claude.roblez@free.fr
Thu Jan 6 14:02: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] 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 (&notify_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)

FYI: installed cygwin 1.5.12-1 on XP SP2

Any comments and/or a fix in an upcoming snapshot or release will be
appreciated.

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