* fcntl.cc (fcntl64): Call pthread_testcancel.

* fhandler_socket.cc (fhandler_socket::connect): Ditto.
	(fhandler_socket::accept4): Ditto.
	(fhandler_socket::recvfrom): Ditto.
	(fhandler_socket::recvmsg): Ditto.
	(fhandler_socket::sendto): Ditto.
	(fhandler_socket::sendmsg): Ditto.
	* flock.cc (lf_setlock): Allow to cancel thread running blocking
	file lock.  Try to make code more readable.
	(lockf): Call pthread_testcancel.
	* mmap.cc (msync): Ditto.
	* posix_ipc.cc (ipc_cond_timedwait): Call pthread::static_cancel_self
	rather than pthread_testcancel.
	* select.cc (cygwin_select): Call pthread_testcancel.
	* syscalls.cc (pread): Ditto.
	(pwrite): Ditto.
	(readv): Ditto.
	(writev): Ditto.
	(open): Ditto.
	(close): Ditto.
	(fsync): Ditto.
	* termios.cc (tcdrain): Ditto.
	* thread.cc: Align list of cancellation points with above changes.
	Mark not-implemented functions, too.
	(cancelable_wait): Don't set unused object indices to WAIT_FAILED
	since that could result in wrong behaviour.  Set them to the invalid
	value WAIT_TIMEOUT + 1 instead.
This commit is contained in:
Corinna Vinschen
2011-04-30 16:34:48 +00:00
parent cbec4110a2
commit 1804be048a
10 changed files with 197 additions and 99 deletions

View File

@ -568,79 +568,80 @@ pthread::cancel ()
/* TODO: Insert pthread_testcancel into the required functions.
Here are the lists of required and optional functions per POSIX.1-2001
and POSIX.1-2008. A start (*) indicates that the Cygwin function already
is a cancellation point (aka "calls pthread_testcancel").
and POSIX.1-2008. A star (*) indicates that the Cygwin function already
is a cancellation point (aka "calls pthread_testcancel"), an o (o)
indicates that the function is not implemented in Cygwin.
Required cancellation points:
accept ()
aio_suspend ()
clock_nanosleep ()
* accept ()
o aio_suspend ()
o clock_nanosleep ()
* close ()
connect ()
* connect ()
* creat ()
fcntl () F_SETLKW
fdatasync ()
fsync ()
getmsg ()
getpmsg ()
lockf () F_LOCK
* fcntl () F_SETLKW
* fdatasync ()
* fsync ()
o getmsg ()
o getpmsg ()
* lockf () F_LOCK
* mq_receive ()
* mq_send ()
* mq_timedreceive ()
* mq_timedsend ()
msgrcv ()
msgsnd ()
msync ()
nanosleep ()
open ()
openat ()
* msync ()
* nanosleep ()
* open ()
* openat ()
* pause ()
poll ()
pread ()
* pread ()
pselect ()
* pthread_cond_timedwait ()
* pthread_cond_wait ()
* pthread_join ()
* pthread_testcancel ()
putmsg ()
putpmsg ()
pwrite ()
read ()
readv ()
recv ()
recvfrom ()
recvmsg ()
o putmsg ()
o putpmsg ()
* pwrite ()
* read ()
* readv ()
* recv ()
* recvfrom ()
* recvmsg ()
select ()
* sem_timedwait ()
* sem_wait ()
send ()
sendmsg ()
sendto ()
* send ()
* sendmsg ()
* sendto ()
* sigpause ()
* sigsuspend ()
sigtimedwait ()
sigwait ()
sigwaitinfo ()
o sigtimedwait ()
* sigwait ()
* sigwaitinfo ()
* sleep ()
* system ()
tcdrain ()
* tcdrain ()
* usleep ()
* wait ()
* wait3()
waitid ()
o waitid ()
* waitpid ()
write ()
writev ()
* write ()
* writev ()
Optional cancellation points:
access ()
asctime ()
asctime_r ()
catclose ()
catgets ()
catopen ()
catclose () Implemented externally: libcatgets
catgets () Implemented externally: libcatgets
catopen () Implemented externally: libcatgets
chmod ()
chown ()
closedir ()
@ -648,18 +649,18 @@ pthread::cancel ()
ctermid ()
ctime ()
ctime_r ()
dbm_close ()
dbm_delete ()
dbm_fetch ()
dbm_nextkey ()
dbm_open ()
dbm_store ()
dbm_close () Implemented externally: libgdbm
dbm_delete () Implemented externally: libgdbm
dbm_fetch () Implemented externally: libgdbm
dbm_nextkey () Implemented externally: libgdbm
dbm_open () Implemented externally: libgdbm
dbm_store () Implemented externally: libgdbm
dlclose ()
dlopen ()
dprintf ()
endgrent ()
endhostent ()
endnetent ()
o endnetent ()
endprotoent ()
endpwent ()
endservent ()
@ -669,15 +670,15 @@ pthread::cancel ()
fchmodat ()
fchown ()
fchownat ()
fclose ()
fcntl () (any value)
* fclose ()
* fcntl () (any value)
fflush ()
fgetc ()
fgetpos ()
fgets ()
fgetwc ()
fgetws ()
fmtmsg ()
o fmtmsg ()
fopen ()
fpathconf ()
fprintf ()
@ -706,7 +707,7 @@ pthread::cancel ()
getchar ()
getchar_unlocked ()
getcwd ()
getdate ()
o getdate ()
getdelim ()
getgrent ()
getgrgid ()
@ -722,9 +723,9 @@ pthread::cancel ()
getlogin ()
getlogin_r ()
getnameinfo ()
getnetbyaddr ()
getnetbyname ()
getnetent ()
o getnetbyaddr ()
o getnetbyname ()
o getnetent ()
getopt () (if opterr is nonzero)
getprotobyname ()
getprotobynumber ()
@ -745,15 +746,15 @@ pthread::cancel ()
getwchar ()
getwd ()
glob ()
iconv_close ()
iconv_open ()
iconv_close () Implemented externally: libiconv
iconv_open () Implemented externally: libiconv
ioctl ()
link ()
linkat ()
lio_listio ()
o lio_listio ()
localtime ()
localtime_r ()
lockf ()
* lockf ()
lseek ()
lstat ()
mkdir ()
@ -776,28 +777,28 @@ pthread::cancel ()
posix_fallocate ()
posix_madvise ()
posix_openpt ()
posix_spawn ()
posix_spawnp ()
posix_trace_clear ()
posix_trace_close ()
posix_trace_create ()
posix_trace_create_withlog ()
posix_trace_eventtypelist_getnext_id ()
posix_trace_eventtypelist_rewind ()
posix_trace_flush ()
posix_trace_get_attr ()
posix_trace_get_filter ()
posix_trace_get_status ()
posix_trace_getnext_event ()
posix_trace_open ()
posix_trace_rewind ()
posix_trace_set_filter ()
posix_trace_shutdown ()
posix_trace_timedgetnext_event ()
posix_typed_mem_open ()
o posix_spawn ()
o posix_spawnp ()
o posix_trace_clear ()
o posix_trace_close ()
o posix_trace_create ()
o posix_trace_create_withlog ()
o posix_trace_eventtypelist_getnext_id ()
o posix_trace_eventtypelist_rewind ()
o posix_trace_flush ()
o posix_trace_get_attr ()
o posix_trace_get_filter ()
o posix_trace_get_status ()
o posix_trace_getnext_event ()
o posix_trace_open ()
o posix_trace_rewind ()
o posix_trace_set_filter ()
o posix_trace_shutdown ()
o posix_trace_timedgetnext_event ()
o posix_typed_mem_open ()
printf ()
psiginfo ()
psignal ()
o psiginfo ()
o psignal ()
pthread_rwlock_rdlock ()
pthread_rwlock_timedrdlock ()
pthread_rwlock_timedwrlock ()
@ -825,7 +826,7 @@ pthread::cancel ()
semop ()
setgrent ()
sethostent ()
setnetent ()
o setnetent ()
setprotoent ()
setpwent ()
setservent ()
@ -908,7 +909,7 @@ cancelable_wait (HANDLE object, DWORD timeout,
DWORD cancel_n;
if (cancel_action == cw_no_cancel || !pthread::is_good_object (&thread) ||
thread->cancelstate == PTHREAD_CANCEL_DISABLE)
cancel_n = (DWORD) -1;
cancel_n = WAIT_TIMEOUT + 1;
else
{
cancel_n = WAIT_OBJECT_0 + num++;
@ -917,7 +918,7 @@ cancelable_wait (HANDLE object, DWORD timeout,
DWORD sig_n;
if (sig_wait == cw_sig_nosig || &_my_tls != _main_tls)
sig_n = (DWORD) -1;
sig_n = WAIT_TIMEOUT + 1;
else
{
sig_n = WAIT_OBJECT_0 + num++;