Using cygwin 1.5.11-1 or snapshot 2004-Oct-10 on XP Pro SP2, a thread
blocked at a write() to a full pipe does not appear cancellable with
pthread_cancel(). "cygcheck.out" is attached.
I'm guessing that POSIX specifies that write() is supposed to be a
cancellation point, but I do not have a copy of the spec (any pointers
would be appreciated). I'm guessing this based on (1) the man pages in
Solaris ('man cancellation'), and (2) the fact that it works as I expect
on the Solaris 9 and Redhat 9.0 systems I've tried. My test code appears
at the end of this e-mail.
Searching with google and searching the cygwin mailing list with keywords
like "pthread_cancel", "thread cancellation", etc., I was unable to find
much relevant information. I did find some old messages claiming that
pthreads were not yet fully implemented in cygwin. If pthread_cancel() is
known to be incomplete or if this is a known bug, then I'd appreciate a
pointer to the relevant information, and I apologize for the repeat.
If I can be of any assistance in resolving this issue, please let me know.
However, I'm not yet intelligent enough about cygwin to try a patch.
Joel Denny
#include <stdlib.h>
#include <stdio.h>
#include <pthread.h>
#include <unistd.h>
int aFd[2];
/* Set this large enough to fill the pipe on your system. */
#define I_PIPE_FILL 90000
void * foo( void * dummy ) {
int i_byte;
/* Use _DISABLE instead to prove that the thread does block on write. */
pthread_setcancelstate( PTHREAD_CANCEL_ENABLE, NULL );
printf( "thread is alive\n" );
fflush( stdout );
for ( i_byte = 0; i_byte < I_PIPE_FILL; ++i_byte ) {
write( aFd[1], "0", 1 );
}
return NULL;
}
int main() {
pthread_t thread;
char a_buf[1];
pipe( aFd ) ) {
pthread_create( &thread, NULL, foo, NULL );
/* Wait until thread has enabled/disabled cancellation. */
read( aFd[0], a_buf, 1 );
printf( "Thread created.\n" );
fflush( stdout );
/* Will not cancel write() on full pipe in cygwin. */
pthread_cancel( thread );
printf( "Thread canceled.\n" );
fflush( stdout );
/* Deadlocks here if thread not cancelled. */
pthread_join( thread, NULL );
printf( "Thread joined.\n" );
fflush( stdout );
return 0;
}
Cygwin Configuration Diagnostics
Current System Time: Tue Oct 19 17:50:53 2004
Windows XP Professional Ver 5.1 Build 2600 Service Pack 2
Path: C:\cygwin\usr\local\bin
C:\cygwin\bin
C:\cygwin\bin
C:\cygwin\usr\X11R6\bin
c:\WINDOWS\system32
c:\WINDOWS
c:\WINDOWS\System32\Wbem
c:\Program Files\PC-Doctor for Windows\services
c:\Program Files\ATI Technologies\ATI Control Panel
c:\Program Files\SSH Communications Security\SSH Secure Shell
Output from C:\cygwin\bin\id.exe (nontsec)
UID: ****(************) GID: ***(None)
513(None)
Output from C:\cygwin\bin\id.exe (ntsec)
UID: ****(************) GID: ***(None)
0(root) ***(None)
544(Administrators) ***(Users)
1014(Debugger Users)
SysDir: C:\WINDOWS\system32
WinDir: C:\WINDOWS
HOME = `%USERPROFILE%'
MAKE_MODE = `unix'
PWD = `/usr/bin/%USERPROFILE%'
USER = `************'
ALLUSERSPROFILE = `C:\Documents and Settings\All Users'
APPDATA = `C:\Documents and Settings\************\Application Data'
COMMONPROGRAMFILES = `C:\Program Files\Common Files'
COMPUTERNAME = `*********'
COMSPEC = `C:\WINDOWS\system32\cmd.exe'
CVS_RSH = `/bin/ssh'
FP_NO_HOST_CHECK = `NO'
HOMEDRIVE = `C:'
HOMEPATH = `\Documents and Settings\************'
HOSTNAME = `*********'
INFOPATH =
`/usr/local/info:/usr/info:/usr/share/info:/usr/autotool/devel/info:/usr/autotool/stable/info:'
LOGONSERVER = `\\*********'
MANPATH =
`/usr/local/man:/usr/man:/usr/share/man:/usr/autotool/devel/man::/usr/ssl/man'
NUMBER_OF_PROCESSORS = `1'
OLDPWD = `/usr/bin'
OS = `Windows_NT'
PATHEXT = `.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH'
PRINTER = `lwtec'
PROCESSOR_ARCHITECTURE = `x86'
PROCESSOR_IDENTIFIER = `x86 Family 15 Model 2 Stepping 7, GenuineIntel'
PROCESSOR_LEVEL = `15'
PROCESSOR_REVISION = `0207'
PROGRAMFILES = `C:\Program Files'
PROMPT = `$P$G'
PS1 = `\[\033]0;\w\007
[EMAIL PROTECTED] \[\033[33m\w\033[0m\]
$ '
SESSIONNAME = `Console'
SHLVL = `1'
SYSTEMDRIVE = `C:'
SYSTEMROOT = `C:\WINDOWS'
TEMP = `C:\DOCUME~1\********\LOCALS~1\Temp'
TERM = `cygwin'
TMP = `C:\DOCUME~1\********\LOCALS~1\Temp'
USERDOMAIN = `*********'
USERNAME = `************'
USERPROFILE = `C:\Documents and Settings\************'
WINDIR = `C:\WINDOWS'
_ = `/usr/bin/cygcheck'
POSIXLY_CORRECT = `1'
HKEY_CURRENT_USER\Software\Cygnus Solutions
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\mounts v2
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
(default) = `/cygdrive'
cygdrive flags = 0x00000022
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/
(default) = `C:\cygwin'
flags = 0x0000000a
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/usr/bin
(default) = `C:\cygwin/bin'
flags = 0x0000000a
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/usr/lib
(default) = `C:\cygwin/lib'
flags = 0x0000000a
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\Program Options
a: fd N/A N/A
c: hd NTFS 69335Mb 20% CP CS UN PA FC IBM_XPIMG
d: hd N/A N/A
e: cd N/A N/A
f: fd N/A N/A
C:\cygwin / system binmode
C:\cygwin/bin /usr/bin system binmode
C:\cygwin/lib /usr/lib system binmode
. /cygdrive system binmode,cygdrive
Found: C:\cygwin\bin\awk.exe
Found: C:\cygwin\bin\bash.exe
Found: C:\cygwin\bin\cat.exe
Found: C:\cygwin\bin\cp.exe
Found: C:\cygwin\bin\cpp.exe
Found: C:\cygwin\bin\find.exe
Found: C:\cygwin\bin\gcc.exe
Found: C:\cygwin\bin\gdb.exe
Found: C:\cygwin\bin\grep.exe
Found: C:\cygwin\bin\ld.exe
Found: C:\cygwin\bin\ls.exe
Found: C:\cygwin\bin\make.exe
Found: C:\cygwin\bin\mv.exe
Found: C:\cygwin\bin\rm.exe
Found: C:\cygwin\bin\sed.exe
Found: C:\cygwin\bin\sh.exe
Found: C:\cygwin\bin\tar.exe
55k 2004/09/14 C:\cygwin\bin\cygbz2-1.dll - os=4.0 img=1.0 sys=4.0
"cygbz2-1.dll" v0.0 ts=2004/9/14 0:16
18k 2004/07/06 C:\cygwin\bin\cygcharset-1.dll - os=4.0 img=1.0 sys=4.0
"cygcharset-1.dll" v0.0 ts=2004/7/6 14:09
7k 2003/10/19 C:\cygwin\bin\cygcrypt-0.dll - os=4.0 img=1.0 sys=4.0
"cygcrypt-0.dll" v0.0 ts=2003/10/19 3:57
839k 2004/09/27 C:\cygwin\bin\cygcrypto-0.9.7.dll - os=4.0 img=1.0 sys=4.0
"cygcrypto-0.9.7.dll" v0.0 ts=2004/9/27 10:10
895k 2004/04/28 C:\cygwin\bin\cygdb-4.2.dll - os=4.0 img=1.0 sys=4.0
"cygdb-4.2.dll" v0.0 ts=2004/4/27 11:31
1156k 2004/04/28 C:\cygwin\bin\cygdb_cxx-4.2.dll - os=4.0 img=1.0 sys=4.0
"cygdb_cxx-4.2.dll" v0.0 ts=2004/4/27 11:35
155k 2004/01/07 C:\cygwin\bin\cygexpat-0.dll - os=4.0 img=1.0 sys=4.0
"cygexpat-0.dll" v0.0 ts=2004/1/7 11:14
40k 2004/10/10 C:\cygwin\bin\cygform-8.dll - os=4.0 img=1.0 sys=4.0
"cygform-8.dll" v0.0 ts=2004/10/10 4:33
45k 2001/04/25 C:\cygwin\bin\cygform5.dll - os=4.0 img=1.0 sys=4.0
"cygform5.dll" v0.0 ts=2001/4/25 1:28
35k 2002/01/09 C:\cygwin\bin\cygform6.dll - os=4.0 img=1.0 sys=4.0
"cygform6.dll" v0.0 ts=2002/1/9 1:03
48k 2003/08/09 C:\cygwin\bin\cygform7.dll - os=4.0 img=1.0 sys=4.0
"cygform7.dll" v0.0 ts=2003/8/9 5:25
28k 2003/07/20 C:\cygwin\bin\cyggdbm-3.dll - os=4.0 img=1.0 sys=4.0
"cyggdbm-3.dll" v0.0 ts=2003/7/20 3:58
30k 2003/08/11 C:\cygwin\bin\cyggdbm-4.dll - os=4.0 img=1.0 sys=4.0
"cyggdbm-4.dll" v0.0 ts=2003/8/10 22:12
19k 2003/03/22 C:\cygwin\bin\cyggdbm.dll - os=4.0 img=1.0 sys=4.0
"cyggdbm.dll" v0.0 ts=2002/2/19 22:05
15k 2003/07/20 C:\cygwin\bin\cyggdbm_compat-3.dll - os=4.0 img=1.0 sys=4.0
"cyggdbm_compat-3.dll" v0.0 ts=2003/7/20 4:00
15k 2003/08/11 C:\cygwin\bin\cyggdbm_compat-4.dll - os=4.0 img=1.0 sys=4.0
"cyggdbm_compat-4.dll" v0.0 ts=2003/8/10 22:13
107k 2004/07/06 C:\cygwin\bin\cyggettextlib-0-14-1.dll - os=4.0 img=1.0 sys=4.0
"cyggettextlib-0-14-1.dll" v0.0 ts=2004/7/6 13:56
17k 2004/07/06 C:\cygwin\bin\cyggettextpo-0.dll - os=4.0 img=1.0 sys=4.0
"cyggettextpo-0.dll" v0.0 ts=2004/7/6 13:56
190k 2004/07/06 C:\cygwin\bin\cyggettextsrc-0-14-1.dll - os=4.0 img=1.0 sys=4.0
"cyggettextsrc-0-14-1.dll" v0.0 ts=2004/7/6 13:56
17k 2001/06/28 C:\cygwin\bin\cyghistory4.dll - os=4.0 img=1.0 sys=4.0
"cyghistory4.dll" v0.0 ts=2001/1/6 23:34
29k 2003/08/10 C:\cygwin\bin\cyghistory5.dll - os=4.0 img=1.0 sys=4.0
"cyghistory5.dll" v0.0 ts=2003/8/10 19:16
25k 2004/10/12 C:\cygwin\bin\cyghistory6.dll - os=4.0 img=1.0 sys=4.0
"cyghistory6.dll" v0.0 ts=2004/10/12 2:51
991k 2004/07/06 C:\cygwin\bin\cygiconv-2.dll - os=4.0 img=1.0 sys=4.0
"cygiconv-2.dll" v0.0 ts=2004/7/6 14:10
22k 2001/12/13 C:\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
37k 2003/08/10 C:\cygwin\bin\cygintl-2.dll - os=4.0 img=1.0 sys=4.0
"cygintl-2.dll" v0.0 ts=2003/8/10 17:50
54k 2004/07/06 C:\cygwin\bin\cygintl-3.dll - os=4.0 img=1.0 sys=4.0
"cygintl-3.dll" v0.0 ts=2004/7/6 13:51
144k 2004/08/29 C:\cygwin\bin\cygmagic-1.dll - os=4.0 img=1.0 sys=4.0
"cygmagic-1.dll" v0.0 ts=2004/8/29 16:25
22k 2004/10/10 C:\cygwin\bin\cygmenu-8.dll - os=4.0 img=1.0 sys=4.0
"cygmenu-8.dll" v0.0 ts=2004/10/10 4:33
26k 2001/04/25 C:\cygwin\bin\cygmenu5.dll - os=4.0 img=1.0 sys=4.0
"cygmenu5.dll" v0.0 ts=2001/4/25 1:27
20k 2002/01/09 C:\cygwin\bin\cygmenu6.dll - os=4.0 img=1.0 sys=4.0
"cygmenu6.dll" v0.0 ts=2002/1/9 1:03
29k 2003/08/09 C:\cygwin\bin\cygmenu7.dll - os=4.0 img=1.0 sys=4.0
"cygmenu7.dll" v0.0 ts=2003/8/9 5:25
74k 2004/10/10 C:\cygwin\bin\cygncurses++-8.dll - os=4.0 img=1.0 sys=4.0
"cygncurses++-8.dll" v0.0 ts=2004/10/10 4:33
156k 2001/04/25 C:\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
175k 2002/01/09 C:\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
216k 2004/10/10 C:\cygwin\bin\cygncurses-8.dll - os=4.0 img=1.0 sys=4.0
"cygncurses-8.dll" v0.0 ts=2004/10/10 4:25
226k 2001/04/25 C:\cygwin\bin\cygncurses5.dll - os=4.0 img=1.0 sys=4.0
"cygncurses5.dll" v0.0 ts=2001/4/25 1:17
202k 2002/01/09 C:\cygwin\bin\cygncurses6.dll - os=4.0 img=1.0 sys=4.0
"cygncurses6.dll" v0.0 ts=2002/1/9 1:03
224k 2003/08/09 C:\cygwin\bin\cygncurses7.dll - os=4.0 img=1.0 sys=4.0
"cygncurses7.dll" v0.0 ts=2003/8/9 5:24
13k 2004/10/10 C:\cygwin\bin\cygpanel-8.dll - os=4.0 img=1.0 sys=4.0
"cygpanel-8.dll" v0.0 ts=2004/10/10 4:32
15k 2001/04/25 C:\cygwin\bin\cygpanel5.dll - os=4.0 img=1.0 sys=4.0
"cygpanel5.dll" v0.0 ts=2001/4/25 1:27
12k 2002/01/09 C:\cygwin\bin\cygpanel6.dll - os=4.0 img=1.0 sys=4.0
"cygpanel6.dll" v0.0 ts=2002/1/9 1:03
19k 2003/08/09 C:\cygwin\bin\cygpanel7.dll - os=4.0 img=1.0 sys=4.0
"cygpanel7.dll" v0.0 ts=2003/8/9 5:24
62k 2003/12/11 C:\cygwin\bin\cygpcre-0.dll - os=4.0 img=1.0 sys=4.0
"cygpcre-0.dll" v0.0 ts=2003/12/11 12:01
63k 2003/04/11 C:\cygwin\bin\cygpcre.dll - os=4.0 img=1.0 sys=4.0
"cygpcre.dll" v0.0 ts=2003/4/11 4:31
9k 2003/12/11 C:\cygwin\bin\cygpcreposix-0.dll - os=4.0 img=1.0 sys=4.0
"cygpcreposix-0.dll" v0.0 ts=2003/12/11 12:01
61k 2003/04/11 C:\cygwin\bin\cygpcreposix.dll - os=4.0 img=1.0 sys=4.0
"cygpcreposix.dll" v0.0 ts=2003/4/11 4:31
1061k 2004/08/19 C:\cygwin\bin\cygperl5_8_5.dll - os=4.0 img=1.0 sys=4.0
"cygperl5_8_5.dll" v0.0 ts=2004/8/19 13:54
22k 2002/06/09 C:\cygwin\bin\cygpopt-0.dll - os=4.0 img=1.0 sys=4.0
"cygpopt-0.dll" v0.0 ts=2002/6/9 1:45
108k 2001/06/28 C:\cygwin\bin\cygreadline4.dll - os=4.0 img=1.0 sys=4.0
"cygreadline4.dll" v0.0 ts=2001/1/6 23:34
148k 2003/08/10 C:\cygwin\bin\cygreadline5.dll - os=4.0 img=1.0 sys=4.0
"cygreadline5.dll" v0.0 ts=2003/8/10 19:16
144k 2004/10/12 C:\cygwin\bin\cygreadline6.dll - os=4.0 img=1.0 sys=4.0
"cygreadline6.dll" v0.0 ts=2004/10/12 2:51
170k 2004/09/27 C:\cygwin\bin\cygssl-0.9.7.dll - os=4.0 img=1.0 sys=4.0
"cygssl-0.9.7.dll" v0.0 ts=2004/9/27 10:10
62k 2004/10/10 C:\cygwin\bin\cygz.dll - os=4.0 img=1.0 sys=4.0
"cygz.dll" v0.0 ts=2004/10/10 0:09
1113k 2004/10/11 C:\cygwin\bin\cygwin1.dll - os=4.0 img=1.0 sys=4.0
"cygwin1.dll" v0.0 ts=2004/10/10 22:24
Cygwin DLL version info:
DLL version: 1.5.12
DLL epoch: 19
DLL bad signal mask: 19005
DLL old termios: 5
DLL malloc env: 28
API major: 0
API minor: 116
Shared data: 4
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: Sun Oct 10 22:24:53 EDT 2004
Snapshot date: 20041010-22:22:25
Shared id: cygwin1S4
Cygwin Package Information
Last downloaded files to: C:\cygwin
Last downloaded files from:
ftp://ftp-stud.fht-esslingen.de/pub/Mirrors/sources.redhat.com/cygwin
Package Version
_update-info-dir 00230-1
ash 20040127-1
base-files 3.0-3
base-passwd 2.1-1
bash 2.05b-16
binutils 20040725-2
bison 20030307-1
bzip2 1.0.2-6
crypt 1.1-1
cygutils 1.2.5-1
cygwin 1.5.11-1
cygwin-doc 1.3-7
diffutils 2.8.7-1
editrights 1.01-1
expat 1.95.7-1
file 4.10-1
fileutils 4.1-2
findutils 4.1.7-4
flex 2.5.4a-3
gawk 3.1.4-3
gcc-core 3.3.3-3
gcc-mingw-core 20040810-1
gdb 20030919-1
gdbm 1.8.3-7
grep 2.5-1
groff 1.18.1-2
gzip 1.3.5-1
less 381-1
libbz2_1 1.0.2-6
libcharset1 1.9.2-1
libdb4.2 4.2.52-1
libgdbm 1.8.0-5
libgdbm-devel 1.8.3-7
libgdbm3 1.8.3-3
libgdbm4 1.8.3-7
libgettextpo0 0.14.1-1
libiconv 1.9.2-1
libiconv2 1.9.2-1
libintl1 0.10.40-1
libintl2 0.12.1-3
libintl3 0.14.1-1
libncurses5 5.2-1
libncurses6 5.2-8
libncurses7 5.3-4
libncurses8 5.4-1
libpcre 4.1-1
libpcre0 4.5-1
libpopt0 1.6.4-4
libreadline4 4.1-2
libreadline5 4.3-5
libreadline6 5.0-1
login 1.9-7
m4 1.4-1
make 3.80-1
man 1.5o-1
mingw-runtime 3.5-1
mktemp 1.5-3
ncurses 5.4-1
openssl 0.9.7d-2
perl 5.8.5-3
perl_manpages 5.8.5-3
python 2.3.4-2
readline 5.0-1
sed 4.1.2-1
sh-utils 2.0.15-4
tar 1.13.25-5
tcltk 20030901-1
termcap 20021106-2
terminfo 5.4_20041009-1
texinfo 4.2-4
textutils 2.0.21-1
vim 6.3-1
w32api 3.1-1
which 1.5-2
zlib 1.2.2-1
Use -h to see help about each section
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/