tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

pr_sleep.rst (1203B)


      1 PR_Sleep
      2 ========
      3 
      4 Causes the current thread to yield for a specified amount of time.
      5 
      6 
      7 Syntax
      8 ------
      9 
     10 .. code::
     11 
     12   #include <prthread.h>
     13 
     14   PRStatus PR_Sleep(PRIntervalTime ticks);
     15 
     16 
     17 Parameter
     18 ~~~~~~~~~
     19 
     20 :ref:`PR_Sleep` has the following parameter:
     21 
     22 ``ticks``
     23   The number of ticks you want the thread to sleep for (see
     24   :ref:`PRIntervalTime`).
     25 
     26 
     27 Returns
     28 ~~~~~~~
     29 
     30 Calling :ref:`PR_Sleep` with a parameter equivalent to
     31 ``PR_INTERVAL_NO_TIMEOUT`` is an error and results in a ``PR_FAILURE``
     32 error.
     33 
     34 
     35 Description
     36 -----------
     37 
     38 :ref:`PR_Sleep` simply waits on a condition for the amount of time
     39 specified. If you set ticks to ``PR_INTERVAL_NO_WAIT``, the thread
     40 yields.
     41 
     42 If ticks is not ``PR_INTERVAL_NO_WAIT``, :ref:`PR_Sleep` uses an existing
     43 lock, but has to create a new condition for this purpose. If you have
     44 already created such structures, it is more efficient to use them
     45 directly.
     46 
     47 Calling :ref:`PR_Sleep` with the value of ticks set to
     48 ``PR_INTERVAL_NO_WAIT`` simply surrenders the processor to ready threads
     49 of the same priority. All other values of ticks cause :ref:`PR_Sleep` to
     50 block the calling thread for the specified interval.
     51 
     52 Threads blocked in :ref:`PR_Sleep` are interruptible.