tor-browser

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

prthreadscope.rst (1657B)


      1 PRThreadScope
      2 =============
      3 
      4 The scope of an NSPR thread, specified as a parameter to
      5 :ref:`PR_CreateThread` or returned by :ref:`PR_GetThreadScope`.
      6 
      7 
      8 Syntax
      9 ------
     10 
     11 .. code::
     12 
     13   #include <prthread.h>
     14 
     15   typedef enum PRThreadScope {
     16      PR_LOCAL_THREAD,
     17      PR_GLOBAL_THREAD
     18      PR_GLOBAL_BOUND_THREAD
     19   } PRThreadScope;
     20 
     21 
     22 Enumerators
     23 ~~~~~~~~~~~
     24 
     25 ``PR_LOCAL_THREAD``
     26   A local thread, scheduled locally by NSPR within the process.
     27 ``PR_GLOBAL_THREAD``
     28   A global thread, scheduled by the host OS.
     29 ``PR_GLOBAL_BOUND_THREAD``
     30   A global bound (kernel) thread, scheduled by the host OS
     31 
     32 
     33 Description
     34 -----------
     35 
     36 An enumerator of type :ref:`PRThreadScope` specifies how a thread is
     37 scheduled: either locally by NSPR within the process (a local thread) or
     38 globally by the host (a global thread).
     39 
     40 Global threads are scheduled by the host OS and compete with all other
     41 threads on the host OS for resources. They are subject to fairly
     42 sophisticated scheduling techniques.
     43 
     44 Local threads are scheduled by NSPR within the process. The process is
     45 assumed to be globally scheduled, but NSPR can manipulate local threads
     46 without system intervention. In most cases, this leads to a significant
     47 performance benefit.
     48 
     49 However, on systems that require NSPR to make a distinction between
     50 global and local threads, global threads are invariably required to do
     51 any form of I/O. If a thread is likely to do a lot of I/O, making it a
     52 global thread early is probably warranted.
     53 
     54 On systems that don't make a distinction between local and global
     55 threads, NSPR silently ignores the scheduling request. To find the scope
     56 of the thread, call :ref:`PR_GetThreadScope`.