This is the mail archive of the cygwin@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]

alarm();pause();alarm();pause(); doesn't pause in pthread


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.

Now, in my second thread, if I unblock SIGALRM using pthread_sigmask(), 
which I believe only affects the second thread, I get a strange result.  (I 
also install a signal handler for this thread, fwiw.)  If I run code X, 
only the first pause() call actually waits for the alarm.  The remaining 
three pauses return immediately, no delay.  (Or, possibly the remaining 
alarms() immediately signal.)

I am somewhat new to UNIX, and am also somewhat new to Cygwin, so I 
apologize if this is just due to some lack of knowledge on my part.

Thanks much,
Rob

P.S., the cygcheck.out file should be attached, containing all the relevant 
system configuration data.  I'm using the latest version of the Cygwin dll. 

Attachment: cygcheck.out
Description: Text document

--
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/

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