Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Jan 2015 23:39:19 +1100 (EST)
From:      Bruce Evans <brde@optusnet.com.au>
To:        Konstantin Belousov <kostikbel@gmail.com>
Cc:        Craig Rodrigues <rodrigc@freebsd.org>, svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r276802 - head/lib/libc/gen
Message-ID:  <20150108225422.B1123@besplex.bde.org>
In-Reply-To: <20150108102708.GP42409@kib.kiev.ua>
References:  <201501080127.t081Ri85035157@svn.freebsd.org> <20150108102708.GP42409@kib.kiev.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 8 Jan 2015, Konstantin Belousov wrote:

> On Thu, Jan 08, 2015 at 01:27:44AM +0000, Craig Rodrigues wrote:
>> @@ -43,11 +43,11 @@
>>  .Sh DESCRIPTION
>>  The
>>  .Fn sleep
>> -function suspends execution of the calling process until either
>> +function suspends execution of the calling thread until either
>>  .Fa seconds
>> -seconds have elapsed or a signal is delivered to the process and its
>> +seconds have elapsed or a signal is delivered to the thread and its
>>  action is to invoke a signal-catching function or to terminate the
>> -process.
>> +thread or process.
> There is no signal action to terminate thread.

There is another bug: the process may be terminated by means other than
a signal (usually just by exit() in another thread).  This case is not
mentioned.

These bugs are missing in POSIX.  It says:

   "or a signal is delivered to the calling thread and its action is to
   invoke a signal-catching function, or the process is terminated"

The second clause (after the comma) seems hard to parse until you realise
that it is intentionally separate from the signal case.  When there was
only 1 thread per process, the only way to terminate a process was via
a signal.  The FreeBSD description still covers only that case.

Related bugs found by grepping for "process" and "thread" in sleep man
pages (unless I missed other changes):

- nanosleep(2) still says "process" in its NAME and ERRORS sections
   It has no other uses of "process" so no correct ones.
- nanosleep(2) is missing the description of early returns for signals
   and terminations in the DESCRIPTION section.  It has a little about
   this in the RETURN VALUES section.  The latter has the only use of
   "thread".  Many more are needed
- usleep(3) is still almost identical to the old version of sleep(3)
- clock_nanosleep(2) is broken (not supported).

In POSIX, the above POSIX wording is used in these 3 functions and
nowhere else.  Both POSIX and FreeBSD are less verbose in describing
when [p]select() and poll() return early due to a timeout.

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20150108225422.B1123>