This is the mail archive of the
cygwin@cygwin.com
mailing list for the Cygwin project.
Re: alarm();pause();alarm();pause(); doesn't pause in pthread
- From: Christopher Faylor <cygwin at cygwin dot com>
- To: cygwin at cygwin dot com
- Cc: rgibson at MIT dot EDU
- Date: Wed, 20 Mar 2002 11:23:54 -0500
- Subject: Re: alarm();pause();alarm();pause(); doesn't pause in pthread
- References: <5.1.0.14.0.20020320010350.0211c960@po12.mit.edu>
- Reply-to: cygwin at cygwin dot com
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/