delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/01/06/09:10:15

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/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
Date: Thu, 6 Jan 2005 09:09:50 -0500
From: Christopher Faylor <cgf-no-personal-reply-please AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: timer_create / POSIX non conformance ?
Message-ID: <20050106140950.GE8126@trixie.casa.cgf.cx>
Reply-To: cygwin AT cygwin DOT com
References: <1105019442 DOT 41dd4232c0e7b AT imp1-q DOT free DOT fr>
Mime-Version: 1.0
In-Reply-To: <1105019442.41dd4232c0e7b@imp1-q.free.fr>
User-Agent: Mutt/1.4.1i

On Thu, Jan 06, 2005 at 02:50:42PM +0100, claude DOT roblez AT free DOT 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 (&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)

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 (&notify_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/

- Raw text -


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