This is the mail archive of the cygwin-patches@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix nanosleep


On Tue, May 06, 2003 at 03:24:56PM +0200, Thomas Pfaff wrote:
>While i am investigating some problems with threads and signals

I don't know what you're investigating but the basic problem with threads
and signals is that you can't send a signal to a thread.  I never implemented
that part of signal delivery.

>i have found a bug in nanosleep where signal_arrived is unnecessary
>checked twice.  This will lead to problems if the event is reset
>between the two checks.  I can provide a testcase if someone is
>interested in details.  AFAICT this problem occurs only in
>multithreaded apps.
>
>2002-05-06 Thomas Pfaff <tpfaff@gmx.net>
>
>* signal.cc (nanosleep): Do not wait twice for signal arrival.

Please check this in.  Looks like an old bug.

cgf

>--- signal.cc.org	2003-05-06 15:10:03.000000000 +0200
>+++ signal.cc	2003-05-06 15:11:04.000000000 +0200
>@@ -88,7 +88,7 @@ nanosleep (const struct timespec *rqtp, 
>   int rc = pthread::cancelable_wait (signal_arrived, req);
>   DWORD now = GetTickCount ();
>   DWORD rem = (rc == WAIT_TIMEOUT || now >= end_time) ? 0 : end_time - now;
>-  if (WaitForSingleObject (signal_arrived, 0) == WAIT_OBJECT_0)
>+  if (rc == WAIT_OBJECT_0)
>     {
>       (void) thisframe.call_signal_handler ();
>       set_errno (EINTR);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]