document the return values for all thread synchronization functions

This commit is contained in:
Marius Gerbershagen 2023-07-08 15:38:48 +02:00
parent 889f93fc08
commit f400d2ae5e
3 changed files with 16 additions and 9 deletions

View file

@ -55,8 +55,11 @@ Returns the number of threads waiting on @var{barrier}.
@lspdef mp:barrier-wait @lspdef mp:barrier-wait
@defun mp:barrier-wait barrier @defun mp:barrier-wait barrier
The caller thread waits on @var{barrier}. When the barrier is The caller thread waits on @var{barrier}. When the barrier is saturated
saturated then all threads waiting on it are unblocked. then all threads waiting on it are unblocked. Returns @code{t} if the
calling thread had to wait to pass the barrier, @code{:unblocked} if the
barrier is enabled but could be passed without waiting and @code{nil} if
the barrier is disabled.
@end defun @end defun
@ -73,5 +76,7 @@ disabled then all calls to @coderef{mp:barrier-wait} immedietely
return. return.
@var{kill-waiting} is used to kill all woken threads. @var{kill-waiting} is used to kill all woken threads.
Returns no values.
@end defun @end defun

View file

@ -29,8 +29,8 @@ Creates a condition variable.
Release @var{lock} and suspend thread until Release @var{lock} and suspend thread until
@coderef{mp:condition-variable-signal} or @coderef{mp:condition-variable-signal} or
@coderef{mp:condition-variable-broadcast} is called on @var{cv}. When @coderef{mp:condition-variable-broadcast} is called on @var{cv}. When
thread resumes re-aquire @var{lock}. May signal an error if @var{lock} thread resumes re-aquire @var{lock}. Always returns @code{t}. May signal
is not owned by the current thread. an error if @var{lock} is not owned by the current thread.
@strong{Note:} In some circumstances, the thread may wake up even if no @strong{Note:} In some circumstances, the thread may wake up even if no
call to @coderef{mp:condition-variable-signal} or call to @coderef{mp:condition-variable-signal} or
@ -54,8 +54,8 @@ behaviour is undefined if this constraint is violated.
@defun mp:condition-variable-timedwait cv lock seconds @defun mp:condition-variable-timedwait cv lock seconds
@coderef{mp:condition-variable-wait} which timeouts after @var{seconds} @coderef{mp:condition-variable-wait} which timeouts after @var{seconds}
seconds. May signal an error if @var{lock} is not owned by the current seconds. Returns @code{nil} on timeout and @code{t} otherwise. May
thread. signal an error if @var{lock} is not owned by the current thread.
@end defun @end defun
@ -68,6 +68,7 @@ thread.
@defun mp:condition-variable-signal cv @defun mp:condition-variable-signal cv
Wake up at least one of the waiters of @var{cv}. Usually, this will wake Wake up at least one of the waiters of @var{cv}. Usually, this will wake
up only a single thread, but it may also wake up multiple threads. up only a single thread, but it may also wake up multiple threads.
Always returns @code{t}.
See @coderef{mp:condition-variable-wait}. See @coderef{mp:condition-variable-wait}.
@end defun @end defun
@ -80,7 +81,7 @@ See @coderef{mp:condition-variable-wait}.
@end deftypefun @end deftypefun
@defun mp:condition-variable-broadcast cv @defun mp:condition-variable-broadcast cv
Wake up all waiters of @var{cv}. Wake up all waiters of @var{cv}. Always returns @code{t}.
See @coderef{mp:condition-variable-wait}. See @coderef{mp:condition-variable-wait}.
@end defun @end defun

View file

@ -75,7 +75,7 @@ would not be negative.
Else blocks until the semaphore can be decremented. Returns the old Else blocks until the semaphore can be decremented. Returns the old
count of @var{semaphore} on success. count of @var{semaphore} on success.
If timeout is not @code{niL}, it is the maximum number of seconds to If timeout is not @code{nil}, it is the maximum number of seconds to
wait. If the count cannot be decremented in that time, returns wait. If the count cannot be decremented in that time, returns
@code{nil} without decrementing the count. @code{nil} without decrementing the count.
@end defun @end defun
@ -119,5 +119,6 @@ This function is equivalent to @code{(mp:semaphore-wait semaphore count 0)}
@end deftypefun @end deftypefun
@defun mp:signal-semaphore semaphore &optional (count 1) @defun mp:signal-semaphore semaphore &optional (count 1)
Releases @var{count} units of a resource on @var{semaphore}. Releases @var{count} units of a resource on @var{semaphore}. Returns no
values.
@end defun @end defun