*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->Tru64 Unix man pages -> sleep (9r)              
Title
Content
Arch
Section
 

sleep(9r)

Contents


NAME    [Toc]    [Back]

       sleep - General: Puts a calling process to sleep

SYNOPSIS    [Toc]    [Back]

       void sleep(
               caddr_t *channel,
               long pri );

ARGUMENTS    [Toc]    [Back]

       Specifies  a  unique  address  associated with the calling
       kernel thread to be put to sleep.  Specifies  whether  the
       sleep  request  is interruptible. Setting this argument to
       the PCATCH flag causes the process to sleep in  an  interruptible
  state (that is, the kernel thread can take asynchronous
 signals). Not setting the PCATCH flag causes  the
       process to sleep in an uninterruptible state (that is, the
       kernel thread cannot take asynchronous signals).

DESCRIPTION    [Toc]    [Back]

       The sleep routine puts a calling process to sleep  on  the
       address  specified  by  the  channel argument. Some common
       addresses are the lbolt argument, a buf structure,  and  a
       proc  structure.  This address should be unique to prevent
       unexpected wake/sleep cycles, which can occur if different
       processes  are  sleeping on the same address accidentally.
       If you set the PCATCH flag in the pri argument, the  sleep
       routine puts signals on the queue and does not wake up the
       sleeping process.

       The sleep and wakeup routines block and  then  wake  up  a
       process.  Generally, device drivers call these routines to
       wait for the transfer to complete an  interrupt  from  the
       device.  That  is,  the write routine of the device driver
       sleeps on  the  address  of  a  known  location,  and  the
       device's  Interrupt Service Interface (ISI) wakes the process
 when the device interrupts. It is the  responsibility
       of the wakened process to check if the condition for which
       it was sleeping has been removed.

NOTES    [Toc]    [Back]

       The operating system provides two ways to put a process to
       sleep:  interruptible  and uninterruptible. The sleep routine
 performs an uninterruptible sleep operation if you do
       not  set the PCATCH flag and an interruptible sleep operation
 if you set the PCATCH flag.  This means  that  device
       drivers  cannot call sleep at interrupt context because at
       interrupt context there is no calling process to be put to
       sleep. Thus, a device driver's Interrupt Service Interface
       (ISI) and those routines called from within the  ISI  must
       not call the sleep routine.

       On  this  operating  system, you cannot use pri to set the
       scheduling priority of the calling process.

RETURN VALUES    [Toc]    [Back]

       None






FILES    [Toc]    [Back]

SEE ALSO
       Routines: wakeup(9r)



                                                        sleep(9r)
[ Back ]
 Similar pages
Name OS Title
thread_block Tru64 General: Blocks (puts to sleep) the current kernel thread
assert_wait_mesg Tru64 General: Asserts that the current kernel thread is about to block (sleep)
pthread_atfork Tru64 Declares fork handler routines to be called when the calling thread's process forks a child process
wakeup NetBSD process context sleep and and wakeup
ltsleep NetBSD process context sleep and and wakeup
tsleep NetBSD process context sleep and and wakeup
tsleep OpenBSD process context sleep and wakeup
wakeup OpenBSD process context sleep and wakeup
sleep NetBSD process context sleep and and wakeup
sleep OpenBSD process context sleep and wakeup
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service