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

Rob Gibson rgibson@MIT.EDU
Tue Mar 19 22:55:00 GMT 2002


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. 
-------------- next part --------------

Cygwin Win95/NT Configuration Diagnostics
Current System Time: Tue Mar 19 00:09:55 2002

Windows ME Ver 4.90 Build 3000 

Path:	C:\rob\cygwin\usr\local\bin
	C:\rob\cygwin\bin
	.
	C:\rob\cygwin\bin
	C:\rob\cygwin\usr\local\bin
	C:\rob\cygwin\bin
	C:\rob\cygwin\bin
	c:\ROB\KERBEROS
	c:\WINDOWS
	c:\WINDOWS\COMMAND
	c:\rob\j2sdk1.4.0-rc\bin
	c:\rob\emacs\ispell\bin
	c:\rob\utils
	.

SysDir: C:\WINDOWS\SYSTEM
WinDir: C:\WINDOWS

HOME = `C:\rob\cygwin\rgibson'
MAKE_MODE = `unix'
PWD = `/rgibson/bbdserver'
USER = `rgibson'

BLASTER = `A220 I5 D1 T4 P330'
CMDLINE = `bash --login -i'
COMSPEC = `C:\WINDOWS\COMMAND.COM'
MANPATH = `:/usr/ssl/man:/usr/ssl/man'
OLDPWD = `/rgibson'
PROMPT = `$p$g'
PS1 = `\[\033]0;\w\007
\033[32m\]\u@\h \[\033[33m\w\033[0m\]
$ '
SHLVL = `1'
TEMP = `c:\WINDOWS\TEMP'
TERM = `cygwin'
TMP = `c:\WINDOWS\TEMP'
WINBOOTDIR = `C:\WINDOWS'
WINDIR = `C:\WINDOWS'
_ = `/usr/bin/cygcheck'

HKEY_CURRENT_USER\Software\Cygnus Solutions
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\mounts v2
  (default) = `/cygdrive'
  cygdrive flags = 0x00000022
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\mounts v2\/
  (default) = `C:/rob/cygwin'
  flags = 0x00000002
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\mounts v2\/usr/bin
  (default) = `C:/rob/cygwin/bin'
  flags = 0x00000002
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\mounts v2\/usr/lib
  (default) = `C:/rob/cygwin/lib'
  flags = 0x00000002
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\Program Options
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\Program Options

a:  fd           N/A    N/A                    
c:  hd  FAT32  57256Mb  25% CP    UN           HP_PAVILION
m:  cd  CDFS       1Mb 100%       UN           020203_0120
n:  cd           N/A    N/A                    

C:/rob/cygwin      /          user    binmode
C:/rob/cygwin/bin  /usr/bin   user    binmode
C:/rob/cygwin/lib  /usr/lib   user    binmode
.                  /cygdrive  user    binmode,noumount

Found: C:\rob\cygwin\bin\bash.exe
Found: C:\rob\cygwin\bin\cat.exe
Found: C:\rob\cygwin\bin\cpp.exe
Found: C:\rob\cygwin\bin\find.exe
Found: c:\WINDOWS\COMMAND\find.exe
Warning: C:\rob\cygwin\bin\find.exe hides c:\WINDOWS\COMMAND\find.exe
Found: C:\rob\cygwin\bin\gcc.exe
Found: C:\rob\cygwin\bin\gdb.exe
Found: C:\rob\cygwin\bin\ld.exe
Found: C:\rob\cygwin\bin\ls.exe
Not Found: make
Found: C:\rob\cygwin\bin\sh.exe

   19k 2002/02/20 C:\rob\cygwin\bin\cyggdbm.dll - os=4.0 img=1.0 sys=4.0
                  "cyggdbm.dll" v0.0 ts=2002/2/19 22:05
   22k 2001/12/13 C:\rob\cygwin\bin\cygintl-1.dll - os=4.0 img=1.0 sys=4.0
                  "cygintl-1.dll" v0.0 ts=2001/12/13 4:28
   45k 2001/04/25 C:\rob\cygwin\bin\cygform5.dll - os=4.0 img=1.0 sys=4.0
                  "cygform5.dll" v0.0 ts=2001/4/25 1:28
   26k 2001/04/25 C:\rob\cygwin\bin\cygmenu5.dll - os=4.0 img=1.0 sys=4.0
                  "cygmenu5.dll" v0.0 ts=2001/4/25 1:27
  156k 2001/04/25 C:\rob\cygwin\bin\cygncurses++5.dll - os=4.0 img=1.0 sys=4.0
                  "cygncurses++5.dll" v0.0 ts=2001/4/25 1:29
  226k 2001/04/25 C:\rob\cygwin\bin\cygncurses5.dll - os=4.0 img=1.0 sys=4.0
                  "cygncurses5.dll" v0.0 ts=2001/4/25 1:17
   15k 2001/04/25 C:\rob\cygwin\bin\cygpanel5.dll - os=4.0 img=1.0 sys=4.0
                  "cygpanel5.dll" v0.0 ts=2001/4/25 1:27
   35k 2002/01/09 C:\rob\cygwin\bin\cygform6.dll - os=4.0 img=1.0 sys=4.0
                  "cygform6.dll" v0.0 ts=2002/1/9 1:03
   20k 2002/01/09 C:\rob\cygwin\bin\cygmenu6.dll - os=4.0 img=1.0 sys=4.0
                  "cygmenu6.dll" v0.0 ts=2002/1/9 1:03
  175k 2002/01/09 C:\rob\cygwin\bin\cygncurses++6.dll - os=4.0 img=1.0 sys=4.0
                  "cygncurses++6.dll" v0.0 ts=2002/1/9 1:03
  202k 2002/01/09 C:\rob\cygwin\bin\cygncurses6.dll - os=4.0 img=1.0 sys=4.0
                  "cygncurses6.dll" v0.0 ts=2002/1/9 1:03
   12k 2002/01/09 C:\rob\cygwin\bin\cygpanel6.dll - os=4.0 img=1.0 sys=4.0
                  "cygpanel6.dll" v0.0 ts=2002/1/9 1:03
   17k 2001/06/28 C:\rob\cygwin\bin\cyghistory4.dll - os=4.0 img=1.0 sys=4.0
                  "cyghistory4.dll" v0.0 ts=2001/1/6 23:34
  108k 2001/06/28 C:\rob\cygwin\bin\cygreadline4.dll - os=4.0 img=1.0 sys=4.0
                  "cygreadline4.dll" v0.0 ts=2001/1/6 23:34
   20k 2002/01/13 C:\rob\cygwin\bin\cyghistory5.dll - os=4.0 img=1.0 sys=4.0
                  "cyghistory5.dll" v0.0 ts=2002/1/12 20:27
  121k 2002/01/13 C:\rob\cygwin\bin\cygreadline5.dll - os=4.0 img=1.0 sys=4.0
                  "cygreadline5.dll" v0.0 ts=2002/1/12 20:27
   40k 2001/11/21 C:\rob\cygwin\bin\cygpcre.dll - os=4.0 img=1.0 sys=4.0
                  "cygpcre.dll" v0.0 ts=2001/11/21 17:15
   39k 2001/11/21 C:\rob\cygwin\bin\cygpcreposix.dll - os=4.0 img=1.0 sys=4.0
                  "cygpcreposix.dll" v0.0 ts=2001/11/21 17:15
   50k 2002/03/12 C:\rob\cygwin\bin\cygz.dll - os=4.0 img=1.0 sys=4.0
                  "cygz.dll" v0.0 ts=2002/3/11 23:38
   21k 2001/06/20 C:\rob\cygwin\bin\cygintl.dll - os=4.0 img=1.0 sys=4.0
                  "cygintl.dll" v0.0 ts=2001/6/20 13:09
  621k 2002/01/16 C:\rob\cygwin\bin\cygcrypto.dll - os=4.0 img=1.0 sys=4.0
                  "cygcrypto.dll" v0.0 ts=2002/1/16 4:54
  156k 2002/01/16 C:\rob\cygwin\bin\cygssl.dll - os=4.0 img=1.0 sys=4.0
                  "cygssl.dll" v0.0 ts=2002/1/16 4:54
   81k 2001/10/20 C:\rob\cygwin\bin\cygitcl30.dll - os=4.0 img=1.0 sys=4.0
                  "cygitcl30.dll" v0.0 ts=2001/10/19 20:25
   35k 2001/10/20 C:\rob\cygwin\bin\cygitk30.dll - os=4.0 img=1.0 sys=4.0
                  "cygitk30.dll" v0.0 ts=2001/10/19 20:25
  390k 2001/10/20 C:\rob\cygwin\bin\cygtcl80.dll - os=4.0 img=1.0 sys=4.0
                  "cygtcl80.dll" v0.0 ts=2001/10/19 20:24
    5k 2001/10/20 C:\rob\cygwin\bin\cygtclpip80.dll - os=4.0 img=1.0 sys=4.0
   10k 2001/10/20 C:\rob\cygwin\bin\cygtclreg80.dll - os=4.0 img=1.0 sys=4.0
                  "cygtclreg80.dll" v0.0 ts=2001/10/19 20:24
  623k 2001/10/20 C:\rob\cygwin\bin\cygtk80.dll - os=4.0 img=1.0 sys=4.0
                  "cygtk80.dll" v0.0 ts=2001/10/19 20:25
  751k 2002/02/25 C:\rob\cygwin\bin\cygwin1.dll - os=4.0 img=1.0 sys=4.0
                  "cygwin1.dll" v0.0 ts=2002/2/25 11:14
    Cygwin DLL version info:
        DLL version: 1.3.10
        DLL epoch: 19
        DLL bad signal mask: 19005
        DLL old termios: 5
        DLL malloc env: 28
        API major: 0
        API minor: 51
        Shared data: 3
        DLL identifier: cygwin1
        Mount registry: 2
        Cygnus registry name: Cygnus Solutions
        Cygwin registry name: Cygwin
        Program options name: Program Options
        Cygwin mount registry name: mounts v2
        Cygdrive flags: cygdrive flags
        Cygdrive prefix: cygdrive prefix
        Cygdrive default prefix: 
        Build date: Mon Feb 25 11:14:34 EST 2002
        Shared id: cygwin1S3


Cygwin Package Information
Last downloaded files to: c:\rob\cygwin\tmp
Last downloaded files from: ftp://uiarchive.uiuc.edu/mirrors/ftp/sources.redhat.com/pub/cygwin

Package             Version             
ash                 20020131-1          
bash                2.05a-3             
binutils            20011002-1          
cygwin              1.3.10-1            
diff                0.0                 
fileutils           4.1-1               
findutils           4.1                 
gawk                3.0.4-1             
gcc                 2.95.3-5            
gdb                 20010428-3          
gdbm                1.8.0-4             
gperf               0.0                 
grep                2.5g                
groff               1.17.2-1            
gzip                1.3.2-1             
less                358-3               
libintl             0.10.38-3           
libintl1            0.10.40-1           
libncurses5         5.2-1               
libncurses6         5.2-8               
libreadline4        4.1-2               
libreadline5        4.2a-1              
login               1.4-3               
man                 1.5g-2              
ncurses             5.2-8               
openssh             3.1p1-1             
openssl             0.9.6c-3            
pcre                3.7-1               
readline            4.2a-1              
sed                 3.02-1              
sh-utils            2.0-2               
tar                 1.13.19-1           
tcsh                6.11.00-4           
termcap             20010825-1          
terminfo            5.2-1               
textutils           2.0.21-1            
vim                 6.0.93-1            
w32api              1.2-1               
which               1.5-1               
zlib                1.1.4-1             

Use -h to see help about each section

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


More information about the Cygwin mailing list