sleep(9) 맨 페이지 - 윈디하나의 솔라나라

개요

섹션
맨 페이지 이름
검색(S)

sleep(9)

The  functions  and  handle  event-based  thread  blocking.  If a
thread must wait for an external event, it is put to sleep by  or
Threads  may  also  wait using one of the locking primitive sleep
routines or The parameter is an arbitrary address  that  uniquely
identifies  the  event on which the thread is being put to sleep.
All threads sleeping on a single are  woken  up  later  by  often
called from inside an interrupt routine, to indicate that the re‐
source  the thread was blocking on is available now.  The parame‐
ter specifies a new priority for the thread as well as  some  op‐
tional flags.  If the new priority is not 0, then the thread will
be  made  runnable  with  the  specified when it resumes.  should
never be used, as it is for compatibility only.  A  new  priority
of  0  means to use the thread's current priority when it is made
runnable again.  If includes the flag, pending  signals  are  al‐
lowed  to  interrupt the sleep, otherwise pending signals are ig‐
nored during the sleep.  If is set and a signal becomes  pending,
is  returned  if  the  current system call should be restarted if
possible, and is returned if the system  call  should  be  inter‐
rupted by the signal (return The parameter is a string describing
the  sleep  condition  for tools like Due to the limited space of
those programs to display arbitrary strings, this message  should
not be longer than 6 characters.  The parameter specifies a time‐
out  for  the sleep.  If is not 0, then the thread will sleep for
at most seconds.  If the timeout expires, then the sleep function
will return and functions take parameter instead of It allows the
caller to specify relative or absolute wakeup  time  with  higher
resolution  in form of The parameter allows the caller to specify
wanted absolute event precision.  The parameter allows the caller
to pass additional flags.  Several of the sleep functions includ‐
ing and the locking primitive sleep  routines  specify  an  addi‐
tional lock parameter.  The lock will be released before sleeping
and reacquired before the sleep routine returns.  If includes the
flag, then the lock will not be reacquired before returning.  The
lock  is  used  to  ensure that a condition can be checked atomi‐
cally, and that the current thread can be suspended without miss‐
ing a change to the condition, or an associated wakeup.  In addi‐
tion, all of the sleep routines will fully drop the  mutex  (even
if recursed) while the thread is suspended and will reacquire the
mutex  before  the  function returns.  Note that the mutex may be
specified as the lock to drop.  In that case, however,  the  flag
is  not  allowed.  To avoid lost wakeups, either a lock should be
used to protect against races, or a timeout should  be  specified
to  place an upper bound on the delay due to a lost wakeup.  As a
result, the function should only be invoked with a timeout  of  0
when  the  mutex is held.  The function requires that reference a
default, i.e. non-spin, mutex.  Its use is deprecated in favor of
which provides identical behavior.  The  function  requires  that
reference a spin mutex.  The function does not accept a parameter
and thus does not support changing the current thread's priority,
the  flag,  or  catching signals via the flag.  The function is a
wrapper around that suspends execution of the current thread  for
the  indicated  timeout.  The thread can not be awakened early by
signals or calls to or The function is a variant of which can  be
awakened  early  by signals.  The function makes the first thread
in the queue that is sleeping on the  parameter  runnable.   This
reduces  the  load when a large number of threads are sleeping on
the same address, but only one of them can actually do any useful
work when made runnable.  Due to the way it works,  the  function
requires  that  only related threads sleep on a specific address.
It is the programmer's responsibility to choose a  unique  value.
The older function did not require this, though it was never good
practice  for  threads to share a value.  When converting from to
pay particular attention to ensure that no other threads wait  on
the same If the timeout given by or is based on an absolute real-
time clock value, then the thread should copy the global into its
member  before  reading  the  RTC.  If the real-time clock is ad‐
justed, these functions will set to zero and  return  zero.   The
caller  should reconsider its orientation with the new RTC value.
When awakened by a call to or if a signal is pending and is spec‐
ified, a non-zero error code is returned.  If the thread is awak‐
ened by a call to or the and locking  primitive  sleep  functions
return  0.  Zero can also be returned when the real-time clock is
adjusted; see above regarding Otherwise, a non-zero error code is
returned.  and the locking primitive sleep  functions  will  fail
if:  The  flag was specified, a signal was caught, and the system
call should be interrupted.  The flag was specified, a signal was
caught, and the system call  should  be  restarted.   A  non-zero
timeout was specified and the timeout expired.  The functions and
were  present in They were probably also present in the preceding
PDP-7 version of They  were  the  basic  process  synchronization
model.  The function appeared in and added the parameters and The
function was removed in The function appeared in The function ap‐
peared  in  and the function appeared in The function appeared in
The function appeared in This manual page was written by
















































맨 페이지 내용의 저작권은 맨 페이지 작성자에게 있습니다.
RSS ATOM XHTML 5 CSS3