Subject: Re: alarm();pause();alarm();pause(); doesn't pause in pthread
From: Christopher Faylor <[email-masked]>
To: [email-masked]
Cc: [email-masked]
Date: Wed, 20 Mar 2002 11:23:54 -0500

On Wed, Mar 20, 2002 at 01:03:53AM -0500, Rob Gibson wrote:
>DLL version 1.3.10, running on Windows ME.  I checked the message boards, 
>but did not see this.
>
>Call this code X: {
>   alarm(2);
>   pause();
>   cout << "A";
>   alarm(4);
>   pause();
>   cout << "B";
>   alarm(4);
>   pause();
>   cout << "C";
>   alarm(4);
>   pause();
>   cout << "D";
>}
>
>
>I have two threads.  In the first, my original startup thread, I register a 
>sig handler for SIGALRM.  At this point, if I block the SIGALRM signal, 
>then run X, nothing happens.  Ok.  (If I unblock SIGALRM, I get four calls 
>to my sig handler, spaced the appropriate number of seconds apart.  Ok.)
>
>Now I start a second thread using pthread_create().  In the second thread's 
>function, if I immediately run code X, nothing happens, because my second 
>thread has inherited the blocked nature of SIGALRM.  Ok.

signals do not work with anything but the main thread.  Sorry.

cgf
--
Please do not send me personal email with cygwin questions.
Use the resources at http://cygwin.com/ .

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/