Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ thr_intro(3-thr) — Reliant UNIX 5.44c4

Media Vault

Software Library

Restoration Projects

Artifacts Sought

thr_intro(3-thr)                                           thr_intro(3-thr)

NAME
     thrintro - introduction to DCE Threads

DESCRIPTION
     DCE Threads is a set of routines that you can call to create a mul-
     tithreaded program. Multithreading is used to improve the performance
     of a program. Routines implemented by DCE Threads that are not speci-
     fied by Draft 4 of the POSIX 1003.4a standard are indicated by an np
     suffix on the name. These routines are new primitives.

     The threads routines sort alphabetically in the reference pages; how-
     ever, the tables in this introduction list the routines in the follow-
     ing functional groups:

     -  Threads routines

     -  Routines that implicitly initialize threads package

     -  Attributes object routines

     -  Mutex routines

     -  Condition variable routines

     -  Thread-specific data routines

     -  Threads cancellation routines

     -  Threads priority and scheduling routines

     -  Cleanup routines

     -  The atfork() routine

     -  Signal handling routines




















Page 1                       Reliant UNIX 5.44                Printed 11/98

thr_intro(3-thr)                                           thr_intro(3-thr)

ROUTINES
     ______________________________________________________________________
    |                           Threads routines                          |
    |_______________________________|_____________________________________|
    | Routine                       |  Description                        |
    |_______________________________|_____________________________________|
    | pthreadcreate()              |  Creates a thread                   |
    |_______________________________|_____________________________________|
    | pthreaddelaynp()            |  Causes a thread to wait for a      |
    |                               |  period of time                     |
    |_______________________________|_____________________________________|
    | pthreaddetach()              |  Marks a thread for deletion        |
    |_______________________________|_____________________________________|
    | pthreadequal()               |  Compares one thread identifier to  |
    |                               |  another thread identifier          |
    |_______________________________|_____________________________________|
    | pthreadexit()                |  Terminates the calling thread      |
    |_______________________________|_____________________________________|
    | pthreadjoin()                |  Causes the calling thread to wait  |
    |                               |  for the termination of a specified |
    |                               |  thread                             |
    |_______________________________|_____________________________________|
    | pthreadonce()                |  Calls an initialization routine to |
    |                               |  be executed only once              |
    |_______________________________|_____________________________________|
    | pthreadself()                |  Obtains the identifier of the      |
    |                               |  current thread                     |
    |_______________________________|_____________________________________|
    | pthreadyield()               |  Notifies the scheduler that the    |
    |                               |  current thread will release its    |
    |                               |  processor to other threads of the  |
    |                               |  same or higher priority            |
    |_______________________________|_____________________________________|





















Page 2                       Reliant UNIX 5.44                Printed 11/98

thr_intro(3-thr)                                           thr_intro(3-thr)

     The following DCE Threads routines will, when called, implicitly per-
     form any necessary initialization of the threads package. Thus any
     application using DCE Threads should call one of the following rou-
     tines before calling any other threads routines, in order to ensure
     that the package is properly initialized.

     ______________________________________________________________________
    |       Routines that Implicitly Perform Threads Initialization       |
    |_______________________________|_____________________________________|
    | Routine                       |  Description                        |
    |_______________________________|_____________________________________|
    | pthreadattrcreate()         |  Creates a thread attributes object |
    |_______________________________|_____________________________________|
    | pthreadcreate()              |  Creates a thread                   |
    |_______________________________|_____________________________________|
    | pthreadself()                |  Obtains the identifier of the      |
    |                               |  current thread                     |
    |_______________________________|_____________________________________|
    | pthreadsetprio()             |  Changes the scheduling priority    |
    |                               |  attribute                          |
    |_______________________________|_____________________________________|
    | pthreadgetprio()             |  Obtains the scheduling priority    |
    |                               |  attribute                          |
    |_______________________________|_____________________________________|
    | pthreadsetscheduler()        |  Changes the scheduling policy      |
    |                               |  attribute                          |
    |_______________________________|_____________________________________|
    | pthreadgetscheduler()        |  Obtains the scheduling policy      |
    |                               |  attribute                          |
    |_______________________________|_____________________________________|
    | pthreadonce()                |  Calls an initialization routine to |
    |                               |  be executed only once              |
    |_______________________________|_____________________________________|
    | pthreadkeycreate()           |  Generates a unique thread-specific |
    |                               |  data key value                     |
    |_______________________________|_____________________________________|
    | pthreadmutexattrcreate()    |  Creates a mutex attributes object  |
    |_______________________________|_____________________________________|
    | pthreadmutexinit()          |  Creates a mutex                    |
    |_______________________________|_____________________________________|
    | pthreadcondattrcreate()     |  Creates a condition variable attri-|
    |                               |  butes object                       |
    |_______________________________|_____________________________________|
    | pthreadcondinit()           |  Creates a condition variable       |
    |_______________________________|_____________________________________|
    | pthreadtestcancel()          |  Requests delivery of a pending can-|
    |                               |  cel                                |
    |_______________________________|_____________________________________|






Page 3                       Reliant UNIX 5.44                Printed 11/98

thr_intro(3-thr)                                           thr_intro(3-thr)

     ______________________________________________________________________
    |       Routines that Implicitly Perform Threads Initialization       |
    |_______________________________|_____________________________________|
    | Routine                       |  Description                        |
    |_______________________________|_____________________________________|
    | pthreadsetcancel()           |  Enables or disables the current    |
    |                               |  thread's general cancelability     |
    |_______________________________|_____________________________________|
    | pthreadsetasynccancel()      |  Enables or disables the current    |
    |                               |  thread's asynchronous cancelability|
    |_______________________________|_____________________________________|
    | pthreaddelaynp()            |  Causes a thread to wait for a      |
    |                               |  period of time                     |
    |_______________________________|_____________________________________|

     ______________________________________________________________________
    |                      Attributes Object Routines                     |
    |_______________________________|_____________________________________|
    | Routine                       |  Description                        |
    |_______________________________|_____________________________________|
    | pthreadattrcreate()         |  Creates a thread attributes object |
    |_______________________________|_____________________________________|
    | pthreadattrdelete()         |  Deletes a thread attributes object |
    |_______________________________|_____________________________________|
    | pthreadattrgetinheritsched()|  Obtains the inherit scheduling     |
    |                               |  attribute                          |
    |_______________________________|_____________________________________|
    | pthreadattrgetprio()        |  Obtains the scheduling priority    |
    |                               |  attribute                          |
    |_______________________________|_____________________________________|
    | pthreadattrgetsched()       |  Obtains the scheduling policy      |
    |                               |  attribute                          |
    |_______________________________|_____________________________________|
    | pthreadattrgetstacksize()   |  Obtains the stacksize attribute    |
    |_______________________________|_____________________________________|
    | pthreadattrsetinheritsched()|  Changes the inherit scheduling     |
    |                               |  attribute                          |
    |_______________________________|_____________________________________|
    | pthreadattrsetprio()        |  Changes the scheduling priority    |
    |                               |  attribute                          |
    |_______________________________|_____________________________________|
    | pthreadattrsetsched()       |  Changes the scheduling policy      |
    |                               |  attribute                          |
    |_______________________________|_____________________________________|
    | pthreadattrsetstacksize()   |  Changes the stacksize attribute    |
    |_______________________________|_____________________________________|
    | pthreadcondattrcreate()     |  Creates a condition variable attri-|
    |                               |  butes object                       |
    |_______________________________|_____________________________________|





Page 4                       Reliant UNIX 5.44                Printed 11/98

thr_intro(3-thr)                                           thr_intro(3-thr)

     ______________________________________________________________________
    |                      Attributes Object Routines                     |
    |_______________________________|_____________________________________|
    | Routine                       |  Description                        |
    |_______________________________|_____________________________________|
    | pthreadcondattrdelete()     |  Deletes a condition variable attri-|
    |                               |  butes object                       |
    |_______________________________|_____________________________________|
    | pthreadmutexattrcreate()    |  Creates a mutex attributes object  |
    |_______________________________|_____________________________________|
    | pthreadmutexattrdelete()    |  Deletes a mutex attributes object  |
    |_______________________________|_____________________________________|
    | pthreadmutexattrgetkindnp()|  Obtains the mutex type attribute   |
    |_______________________________|_____________________________________|
    | pthreadmutexattrsetkindnp()|  Changes the mutex type attribute   |
    |_______________________________|_____________________________________|

     ______________________________________________________________________
    |                            Mutex Routines                           |
    |_______________________________|_____________________________________|
    | Routine                       |  Description                        |
    |_______________________________|_____________________________________|
    | pthreadlockglobalnp()      |  Locks a global mutex               |
    |_______________________________|_____________________________________|
    | pthreadmutexdestroy()       |  Deletes a mutex                    |
    |_______________________________|_____________________________________|
    | pthreadmutexinit()          |  Creates a mutex                    |
    |_______________________________|_____________________________________|
    | pthreadmutexlock()          |  Locks a mutex and waits if the     |
    |                               |  mutex is already locked            |
    |_______________________________|_____________________________________|
    | pthreadmutextrylock()       |  Locks a mutex and returns if the   |
    |                               |  mutex is already locked            |
    |_______________________________|_____________________________________|
    | pthreadmutexunlock()        |  Unlocks a mutex                    |
    |_______________________________|_____________________________________|
    | pthreadunlockglobalnp()    |  Unlocks a global mutex             |
    |_______________________________|_____________________________________|
















Page 5                       Reliant UNIX 5.44                Printed 11/98

thr_intro(3-thr)                                           thr_intro(3-thr)

     ______________________________________________________________________
    |                     Condition Variable Routines                     |
    |_______________________________|_____________________________________|
    | Routine                       |  Description                        |
    |_______________________________|_____________________________________|
    | pthreadcondbroadcast()      |  Wakes all threads waiting on a con-|
    |                               |  dition variable                    |
    |_______________________________|_____________________________________|
    | pthreadconddestroy()        |  Deletes a condition variable       |
    |_______________________________|_____________________________________|
    | pthreadcondinit()           |  Creates a condition variable       |
    |_______________________________|_____________________________________|
    | pthreadcondsignal()         |  Wakes one thread waiting on a con- |
    |                               |  dition variable                    |
    |_______________________________|_____________________________________|
    | pthreadcondtimedwait()      |  Causes a thread to wait for a      |
    |                               |  specified period of time for a con-|
    |                               |  dition variable to be signaled or  |
    |                               |  broadcast                          |
    |_______________________________|_____________________________________|
    | pthreadcondwait()           |  Causes a thread to wait for a con- |
    |                               |  dition variable to be signaled or  |
    |                               |  broadcast                          |
    |_______________________________|_____________________________________|
    | pthreadgetexpirationnp()   |  Obtains a value representing a     |
    |                               |  desired expiration time            |
    |_______________________________|_____________________________________|

     ______________________________________________________________________
    |                         Thread-Specific Data                        |
    |_______________________________|_____________________________________|
    | Routine                       |  Description                        |
    |_______________________________|_____________________________________|
    | pthreadgetspecific()         |  Obtains the thread-specific data   |
    |                               |  associated with the specified key  |
    |_______________________________|_____________________________________|
    | pthreadkeycreate()           |  Generates a unique thread-specific |
    |                               |  data key value                     |
    |_______________________________|_____________________________________|
    | pthreadsetspecific()         |  Sets the thread-specific data asso-|
    |                               |  ciated with the specified key      |
    |_______________________________|_____________________________________|












Page 6                       Reliant UNIX 5.44                Printed 11/98

thr_intro(3-thr)                                           thr_intro(3-thr)

     ______________________________________________________________________
    |                    Threads Cancellation Routines                    |
    |_______________________________|_____________________________________|
    | Routine                       |  Description                        |
    |_______________________________|_____________________________________|
    | pthreadcancel()              |  Allows a thread to request termina-|
    |                               |  tion                               |
    |_______________________________|_____________________________________|
    | pthreadsetasynccancel()      |  Enables or disables the current    |
    |                               |  thread's asynchronous cancelability|
    |_______________________________|_____________________________________|
    | pthreadsetcancel()           |  Enables or disables the current    |
    |                               |  thread's general cancelability     |
    |_______________________________|_____________________________________|
    | pthreadsignaltocancelnp() |  Cancels a thread if a signal is    |
    |                               |  received by the process            |
    |_______________________________|_____________________________________|
    | pthreadtestcancel()          |  Requests delivery of a pending can-|
    |                               |  cel                                |
    |_______________________________|_____________________________________|

     ______________________________________________________________________
    |               Threads Priority and Scheduling Routines              |
    |_______________________________|_____________________________________|
    | Routine                       |  Description                        |
    |_______________________________|_____________________________________|
    | pthreadgetprio()             |  Obtains the current priority of a  |
    |                               |  thread                             |
    |_______________________________|_____________________________________|
    | pthreadgetscheduler()        |  Obtains the current scheduling pol-|
    |                               |  icy of a thread                    |
    |_______________________________|_____________________________________|
    | pthreadsetprio()             |  Changes the current priority of a  |
    |                               |  thread                             |
    |_______________________________|_____________________________________|
    | pthreadsetscheduler()        |  Changes the current scheduling pol-|
    |                               |  icy and priority of a thread       |
    |_______________________________|_____________________________________|
















Page 7                       Reliant UNIX 5.44                Printed 11/98

thr_intro(3-thr)                                           thr_intro(3-thr)

     ______________________________________________________________________
    |                           Cleanup Routines                          |
    |_______________________________|_____________________________________|
    | Routine                       |  Description                        |
    |_______________________________|_____________________________________|
    | pthreadcleanuppop()         |  Removes a cleanup handler from the |
    |                               |  stack                              |
    |_______________________________|_____________________________________|
    | pthreadcleanuppush()        |  Establishes a cleanup handler      |
    |_______________________________|_____________________________________|

     ______________________________________________________________________
    |                         The atfork() Routine                        |
    |_______________________________|_____________________________________|
    | Routine                       |  Description                        |
    |_______________________________|_____________________________________|
    | atfork()                      |  Arranges for fork cleanup handling |
    |_______________________________|_____________________________________|

     ______________________________________________________________________
    |                       Signal Handling Routines                      |
    |_______________________________|_____________________________________|
    | Routine                       |  Description                        |
    |_______________________________|_____________________________________|
    | sigaction()                   |  Specifies action to take on receipt|
    |                               |  of signal                          |
    |_______________________________|_____________________________________|
    | sigpending()                  |  Examines pending signals           |
    |_______________________________|_____________________________________|
    | sigprocmask()                 |  Sets the current signal mask       |
    |_______________________________|_____________________________________|
    | sigwait()                     |  Causes thread to wait for asynchro-|
    |                               |  nous signal                        |
    |_______________________________|_____________________________________|




















Page 8                       Reliant UNIX 5.44                Printed 11/98

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026