On Thu, Aug 25, 2011 at 12:29:29AM +0300, Kostik Belousov wrote: > On Wed, Aug 24, 2011 at 10:56:09PM +0200, Jilles Tjoelker wrote: > > sigwait() was fixed not to return EINTR in 9-current in r212405 (fixed > > up in r219709). The discussion started at > > http://lists.freebsd.org/pipermail/freebsd-threads/2010-September/004892.html > > > > Solaris is simply wrong in the same way we were wrong. Although POSIX > > may not be as clear on this as one may like, its intention is clear and > > additionally not returning EINTR reduces subtle portability problems.
> Can you, please, describe why do you consider the behaviour prohibiting > return of EINTR reasonable ? I do consider that the Solaris behaviour is > useful. Applications need to cope with EINTR returns (usually by retrying the call); if they do not do this, bugs arise in uncommon cases. In the case of sigwait(), applications do not really need EINTR: they can include the respective signal into the signal set and do the work inline that was originally in the signal handler. This might require additional pthread_sigmask() calls. This also fixes the race condition almost always associated with EINTR. Historically, this is because sigwait() came with POSIX threads, which also explains why it returns an error number rather than setting errno. The threads group considered EINTR errors not useful enough, given that they may lead to subtle bugs. This is fully standardized for functions like pthread_cond_wait() and pthread_mutex_lock(). In the case of sigwait(), it also plays a role that glibc has decided not to return EINTR, so that returning EINTR may lead to subtle bugs appearing on FreeBSD in software originally written for GNU/Linux. The functions sigwaitinfo() and sigtimedwait() came with POSIX realtime and therefore follow different conventions. -- Jilles Tjoelker _______________________________________________ freebsd-stable@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"