Manual Pages for UNIX Darwin command on man pthread
MyWebUniversity

Manual Pages for UNIX Darwin command on man pthread

PTHREAD(3) BSD Library Functions Manual PTHREAD(3)

NAME

pptthhrreeaadd - POSIX thread functions

SYNOPSIS

##iinncclluuddee <>

DESCRIPTION

POSIX threads are a set of functions that support applications with requirements for multiple flows of control, called threads, within a process. Multithreading is used to improve the performance of a program.

The POSIX thread functions are summarized in this section in the follow-

ing groups: ++oo Thread Routines ++oo Attribute Object Routines ++oo Mutex Routines ++oo Condition Variable Routines ++oo Read/Write Lock Routines

++oo Per-Thread Context Routines

++oo Cleanup Routines TTHHRREEAADD RROOUUTTIINNEESS

int pptthhrreeaaddccrreeaattee(pthreadt *thread, const pthreadattrt *attr, void

*(*startroutine)(void *), void *arg) Creates a new thread of execution.

int pptthhrreeaaddddeettaacchh(pthreadt thread)

Marks a thread for deletion.

int pptthhrreeaaddeeqquuaall(pthreadt t1, pthreadt t2)

Compares two thread IDs. void pptthhrreeaaddeexxiitt(void *valueptr) Terminates the calling thread.

int pptthhrreeaaddjjooiinn(pthreadt thread, void **valueptr)

Causes the calling thread to wait for the termination of the specified thread.

int pptthhrreeaaddccaanncceell(pthreadt thread)

Cancels execution of a thread.

int pptthhrreeaaddoonnccee(pthreadoncet *oncecontrol, void

(*initroutine)(void)) Calls an initialization routine once.

pthreadt pptthhrreeaaddsseellff(void)

Returns the thread ID of the calling thread. int pptthhrreeaaddaattffoorrkk(void (*prepare)(void), void (*parent)(void), void (*child)(void)) Registers handlers to be called before and after ffoorrkk() AATTTTRRIIBBUUTTEE OOBBJJEECCTT RROOUUTTIINNEESS

int pptthhrreeaaddaattttrrddeessttrrooyy(pthreadattrt *attr)

Destroy a thread attributes object.

int pptthhrreeaaddaattttrrggeettiinnhheerriittsscchheedd(const pthreadattrt *attr, int

*inheritsched) Get the inherit scheduling attribute from a thread attributes object.

int pptthhrreeaaddaattttrrggeettsscchheeddppaarraamm(const pthreadattrt *attr, struct

schedparam *param) Get the scheduling parameter attribute from a thread attributes object.

int pptthhrreeaaddaattttrrggeettsscchheeddppoolliiccyy(const pthreadattrt *attr, int *policy)

Get the scheduling policy attribute from a thread attributes object.

int pptthhrreeaaddaattttrrggeettssccooppee(const pthreadattrt *attr, int

*contentionscope) Get the contention scope attribute from a thread attributes object.

int pptthhrreeaaddaattttrrggeettssttaacckkssiizzee(const pthreadattrt *attr, sizet

*stacksize) Get the stack size attribute from a thread attributes object.

int pptthhrreeaaddaattttrrggeettssttaacckkaaddddrr(const pthreadattrt *attr, void

**stackaddr) Get the stack address attribute from a thread attributes object.

int pptthhrreeaaddaattttrrggeettddeettaacchhssttaattee(const pthreadattrt *attr, int

*detachstate) Get the detach state attribute from a thread attributes object.

int pptthhrreeaaddaattttrriinniitt(pthreadattrt *attr)

Initialize a thread attributes object with default values.

int pptthhrreeaaddaattttrrsseettiinnhheerriittsscchheedd(pthreadattrt *attr, int inheritsched)

Set the inherit scheduling attribute in a thread attributes object.

int pptthhrreeaaddaattttrrsseettsscchheeddppaarraamm(pthreadattrt *attr, const struct

schedparam *param) Set the scheduling parameter attribute in a thread attributes object.

int pptthhrreeaaddaattttrrsseettsscchheeddppoolliiccyy(pthreadattrt *attr, int policy)

Set the scheduling policy attribute in a thread attributes object.

int pptthhrreeaaddaattttrrsseettssccooppee(pthreadattrt *attr, int contentionscope)

Set the contention scope attribute in a thread attributes object.

int pptthhrreeaaddaattttrrsseettssttaacckkssiizzee(pthreadattrt *attr, sizet stacksize)

Set the stack size attribute in a thread attributes object.

int pptthhrreeaaddaattttrrsseettssttaacckkaaddddrr(pthreadattrt *attr, void *stackaddr)

Set the stack address attribute in a thread attributes object.

int pptthhrreeaaddaattttrrsseettddeettaacchhssttaattee(pthreadattrt *attr, int detachstate)

Set the detach state in a thread attributes object. MMUUTTEEXX RROOUUTTIINNEESS

int pptthhrreeaaddmmuutteexxaattttrrddeessttrrooyy(pthreadmutexattrt *attr)

Destroy a mutex attributes object.

int pptthhrreeaaddmmuutteexxaattttrriinniitt(pthreadmutexattrt *attr)

Initialize a mutex attributes object with default val-

ues.

int pptthhrreeaaddmmuutteexxddeessttrrooyy(pthreadmutext *mutex)

Destroy a mutex.

int pptthhrreeaaddmmuutteexxiinniitt(pthreadmutext *mutex, const pthreadmutexattrt

*attr) Initialize a mutex with specified attributes.

int pptthhrreeaaddmmuutteexxlloocckk(pthreadmutext *mutex)

Lock a mutex and block until it becomes available.

int pptthhrreeaaddmmuutteexxttrryylloocckk(pthreadmutext *mutex)

Try to lock a mutex, but don't block if the mutex is locked by another thread, including the current thread.

int pptthhrreeaaddmmuutteexxuunnlloocckk(pthreadmutext *mutex)

Unlock a mutex. CCOONNDDIITTIIOONN VVAARRIIAABBLLEE RROOUUTTIINNEESS

int pptthhrreeaaddccoonnddaattttrriinniitt(pthreadcondattrt *attr)

Initialize a condition variable attributes object with default values.

int pptthhrreeaaddccoonnddaattttrrddeessttrrooyy(pthreadcondattrt *attr)

Destroy a condition variable attributes object.

int pptthhrreeaaddccoonnddbbrrooaaddccaasstt(pthreadcondt *cond)

Unblock all threads currently blocked on the specified condition variable.

int pptthhrreeaaddccoonnddddeessttrrooyy(pthreadcondt *cond)

Destroy a condition variable.

int pptthhrreeaaddccoonnddiinniitt(pthreadcondt *cond, const pthreadcondattrt

*attr) Initialize a condition variable with specified attributes.

int pptthhrreeaaddccoonnddssiiggnnaall(pthreadcondt *cond)

Unblock at least one of the threads blocked on the specified condition variable.

int pptthhrreeaaddccoonnddttiimmeeddwwaaiitt(pthreadcondt *cond, pthreadmutext *mutex,

const struct timespec *abstime) Wait no longer than the specified time for a condition and lock the specified mutex.

int pptthhrreeaaddccoonnddwwaaiitt(pthreadcondt *, pthreadmutext *mutex)

Wait for a condition and lock the specified mutex. RREEAADD//WWRRIITTEE LLOOCCKK RROOUUTTIINNEESS

int pptthhrreeaaddrrwwlloocckkddeessttrrooyy(pthreadrwlockt *lock)

Destroy a read/write lock object.

int pptthhrreeaaddrrwwlloocckkiinniitt(pthreadrwlockt *lock, const

pthreadrwlockattrt *attr)

Initialize a read/write lock object.

int pptthhrreeaaddrrwwlloocckkrrddlloocckk(pthreadrwlockt *lock)

Lock a read/write lock for reading, blocking until the lock can be acquired.

int pptthhrreeaaddrrwwlloocckkttrryyrrddlloocckk(pthreadrwlockt *lock)

Attempt to lock a read/write lock for reading, without blocking if the lock is unavailable.

int pptthhrreeaaddrrwwlloocckkttrryywwrrlloocckk(pthreadrwlockt *lock)

Attempt to lock a read/write lock for writing, without blocking if the lock is unavailable.

int pptthhrreeaaddrrwwlloocckkuunnlloocckk(pthreadrwlockt *lock)

Unlock a read/write lock.

int pptthhrreeaaddrrwwlloocckkwwrrlloocckk(pthreadrwlockt *lock)

Lock a read/write lock for writing, blocking until the lock can be acquired.

int pptthhrreeaaddrrwwlloocckkaattttrrddeessttrrooyy(pthreadrwlockattrt *attr)

Destroy a read/write lock attribute object.

int pptthhrreeaaddrrwwlloocckkaattttrrggeettppsshhaarreedd(const pthreadrwlockattrt *attr, int

*pshared) Retrieve the process shared setting for the read/write lock attribute object.

int pptthhrreeaaddrrwwlloocckkaattttrriinniitt(pthreadrwlockattrt *attr)

Initialize a read/write lock attribute object.

int pptthhrreeaaddrrwwlloocckkaattttrrsseettppsshhaarreedd(pthreadrwlockattrt *attr, int

pshared) Set the process shared setting for the read/write lock attribute object.

PPEERR-TTHHRREEAADD CCOONNTTEEXXTT RROOUUTTIINNEESS

int pptthhrreeaaddkkeeyyccrreeaattee(pthreadkeyt *key, void (*routine)(void *))

Create a thread-specific data key.

int pptthhrreeaaddkkeeyyddeelleettee(pthreadkeyt key)

Delete a thread-specific data key.

void * pptthhrreeaaddggeettssppeecciiffiicc(pthreadkeyt key)

Get the thread-specific value for the specified key.

int pptthhrreeaaddsseettssppeecciiffiicc(pthreadkeyt key, const void *valueptr)

Set the thread-specific value for the specified key.

CCLLEEAANNUUPP RROOUUTTIINNEESS void pptthhrreeaaddcclleeaannuuppppoopp(int execute) Remove the routine at the top of the calling thread's cancellation cleanup stack and optionally invoke it. void pptthhrreeaaddcclleeaannuuppppuusshh(void (*routine)(void *), void *routinearg) Push the specified cancellation cleanup handler onto the calling thread's cancellation stack. IINNSSTTAALLLLAATTIIOONN The default system libraries include pptthhrreeaadd funcitons. No additional libraries or CFLAGS are necessary to use this API.

SEE ALSO

pthreadcleanuppop(3), pthreadcleanuppush(3),

pthreadcondbroadcast(3), pthreadconddestroy(3), pthreadcondinit(3),

pthreadcondsignal(3), pthreadcondtimedwait(3), pthreadcondwait(3),

pthreadcreate(3), pthreaddetach(3), pthreadequal(3), pthreadexit(3),

pthreadgetspecific(3), pthreadjoin(3), pthreadkeydelete(3),

pthreadmutexdestroy(3), pthreadmutexinit(3), pthreadmutexlock(3),

pthreadmutextrylock(3), pthreadmutexunlock(3), pthreadonce(3),

pthreadrwlockattrdestroy(3), pthreadrwlockattrgetpshared(3),

pthreadrwlockattrinit(3), pthreadrwlockattrsetpshared(3),

pthreadrwlockdestroy(3), pthreadrwlockinit(3),

pthreadrwlockrdlock(3), pthreadrwlockunlock(3),

pthreadrwlockwrlock(3), pthreadself(3), pthreadsetspecific(3)

STANDARDS

The functions in libc with the pthread prefix and not np suffix or

pthreadrwlock prefix conform to ISO/IEC 9945-1:1996 (``POSIX.1'').

The functions in libc with the pthread prefix and np suffix are non-

portable extensions to POSIX threads.

The functions in libc with the pthreadrwlock prefix are extensions cre-

ated by The Open Group as part of the Version 2 of the Single UNIX Specification (``SUSv2''). Darwin November 5, 2001 Darwin




Contact us      |      About us      |      Term of use      |       Copyright © 2000-2019 MyWebUniversity.com ™