Date: Wed, 18 Aug 2010 13:04:03 +0300 From: Kostik Belousov <kostikbel@gmail.com> To: David Xu <davidxu@freebsd.org> Cc: freebsd-threads@freebsd.org Subject: Re: PTHREAD_CANCEL_DEFERRED Message-ID: <20100818100403.GS2396@deviant.kiev.zoral.com.ua> In-Reply-To: <4C6BE0F7.10207@freebsd.org> References: <4C650F27.1000305@freebsd.org> <20100813141402.GW2396@deviant.kiev.zoral.com.ua> <4C65E0FE.2030803@freebsd.org> <20100814144715.GB2396@deviant.kiev.zoral.com.ua> <4C6926D0.2020909@freebsd.org> <20100816082022.GO2396@deviant.kiev.zoral.com.ua> <4C696A96.7020709@freebsd.org> <20100816104303.GP2396@deviant.kiev.zoral.com.ua> <4C6AA092.40708@freebsd.org> <4C6BE0F7.10207@freebsd.org>
index | next in thread | previous in thread | raw e-mail
[-- Attachment #1 --] On Wed, Aug 18, 2010 at 01:32:39PM +0000, David Xu wrote: > David Xu wrote: > >My idea is to always let close() syscall run, until it will be > >blocked by lower layer, e.g tty or socket layer, as manual of close() > >said it always release the file descriptor despite whether > >it returns EINTR or EWOULDBLOCK, when it is going to sleep, > >a flag will cause it to abort the sleep. > >if the thread does not found the flag at that time, > >a latter signal SIGCANCEL sent by pthread_cancel will unblock it, > >this is how signal works. > > > > I have worked out a patch: > http://people.freebsd.org/~davidxu/patch/thread_cancel.patch > Ok, the patch is definitely better then my proposal. But it has several details that seems to need correction. First, if TDP_WAKEUP-marked thread receives any non-cancellation signal, then a syscall returns with EINTR. This breaks SA_RESTART. Also, I think that a condition to perform cancellation in thr_syscalls.c should be not (ret == -1), but (ret == -1 && errno == EINTR). [-- Attachment #2 --] -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEARECAAYFAkxrsBMACgkQC3+MBN1Mb4jHJACgzVVP9f6BqiiU8kp38JWlA2mn pJ0AoLfssacTaKIHw254auwDhMP6Tt9i =E/yl -----END PGP SIGNATURE-----help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100818100403.GS2396>
