ibm-information-center/dist/eclipse/plugins/i5OS.ic.apis_5.4.0.1/rzah4mst.htm

230 lines
22 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Copyright" content="Copyright (c) 2006 by IBM Corporation">
<title>POSIX thread APIs</title>
<!-- Begin Header Records ========================================= -->
<!-- All rights reserved. Licensed Materials Property of IBM -->
<!-- US Government Users Restricted Rights -->
<!-- Use, duplication or disclosure restricted by -->
<!-- GSA ADP Schedule Contract with IBM Corp. -->
<!-- NETMG2 SCRIPT A converted by B2H R4.1 (346) (CMS) by HOLTJM at -->
<!-- RCHVMW2 on 29 Jan 1999 at 10:01:37 -->
<!-- File Edited November 2001 -->
<!-- 031111 JETAYLOR replaced API and/or Exit listings with -->
<!-- pagegenerator output from javascript array -->
<!-- End Header Records -->
<link rel="stylesheet" type="text/css" href="../rzahg/ic.css">
</head>
<body>
<a name="Top_Of_Page"></a>
<!-- Java sync-link -->
<script language="Javascript" src="../rzahg/synch.js" type="text/javascript">
</script>
<h2>Pthread APIs</h2>
<h3>Before you get started with Pthreads</h3>
<p>Many details in <a href="../rzahw/rzahwovepo.htm">Multithreaded
applications</a> will affect your interpretation of how the Pthread APIs work.
<strong>Multithreaded applications</strong> also contains important general
information about threads. The information includes how process architecture
and process behavior change when running a threaded program, what parts of the
system are not available for use when running a threaded program, and tips on
performance and debugging of threaded jobs.</p>
<p><strong>Programming with Pthreads</strong></p>
<ul>
<li><a name="concept">Pthread concepts and references</a>
<ul>
<li><a href="whatare.htm">What are Pthreads?</a></li>
<li><a href="rzah4pri.htm">Primitive data types</a> -- Naming conventions for
primitive data types in threaded programs.</li>
<li><a href="rzah4mac.htm">Feature test macros</a> -- Descriptions of supported
and unsupported feature test macros.</li>
<li><a href="diffs.htm">i5/OS<SUP>(TM)</SUP> Pthreads versus other threads
implementations</a></li>
<li><a href="rzah4hed.htm">Header files for Pthread functions</a></li>
<li><a href="glossary.htm">Pthread glossary</a> -- Definitions of some common
Pthread terms.</li>
<li><a href="rzah4sou.htm">Other sources of Pthread information</a></li>
</ul>
</li>
<li>Pthread programming basic tasks -- Information to get you started with
Pthreads programming.
<ul>
<li><a href="concept1.htm">Writing and compiling threaded programs</a></li>
<li><a href="293735.htm">Running threaded programs</a></li>
</ul>
</li>
<li><a href="trouble.htm">Troubleshooting Pthread errors</a> -- Descriptions of
common errors users encounter when programming with Pthreads.</li>
</ul>
<h3>Pthread APIs</h3>
<p>For information about the examples included with the APIs, see the
<a href="users_g3.htm">Information on the Pthread API examples</a>. See
<a href="../apiref/aboutapis.htm#codedisclaimer">Code disclaimer information</a>
for information pertaining to code examples.</p>
<p>For information about specific groups of Pthread APIs, see:</p>
<ul>
<li><a href="users_g4.htm">Thread management APIs</a><br><br></li>
<li><a href="users_33.htm">Thread specific storage APIs</a><br><br></li>
<li><a href="users_38.htm">Thread cancellation APIs</a><br><br></li>
<li><a href="users_48.htm">Mutex synchronization API</a><br><br></li>
<li><a href="users_68.htm">Condition variable synchronization APIs</a><br><br></li>
<li><a href="users_80.htm">Read/write lock synchronization APIs</a><br><br></li>
<li><a href="users_94.htm">Signals APIs</a><br><br></li>
<li><a href="users_98.htm">Unsupported Pthread APIs</a>
</ul>
<p>The Pthread APIs are:</p>
<!-- ***** NOTE ***** Do not manually update text or links in this section. -->
<!-- Updates made in this section *will* be overlaid by pagegen tool. -->
<!-- Notify Beth Taylor of needed updates to be made in javascript array.-->
<!--***************API BEGIN PASTE***************-->
<ul>
<li><A HREF="users_98.htm#325492">pthread_atfork()</A> (Register Fork Handlers) </li>
<li><A HREF="users_98.htm#325504">pthread_atfork_np()</A> (Register Fork Handlers with Extended Options) </li>
<li><A HREF="users_g5.htm">pthread_attr_destroy()</A> (Destroy Thread Attributes Object) destroys a thread attributes object and allows the system to reclaim any resources associated with that thread attributes object.</li>
<li><A HREF="users_g6.htm">pthread_attr_getdetachstate()</A> (Get Thread Attributes Object Detachstate) returns the detach state attribute from the thread attributes object specified.</li>
<li><A HREF="users_98.htm#308646">pthread_attr_getguardsize()</A> (Get Guard Size) </li>
<li><A HREF="users_g7.htm">pthread_attr_getinheritsched()</A> (Get Thread Attribute Object Inherit Scheduling Attributes) returns the inheritsched attribute from the thread attributes object specified.</li>
<li><A HREF="users_g8.htm">pthread_attr_getschedparam()</A> (Get Thread Attributes Object Scheduling Parameters) returns the scheduling parameters attribute from the thread attributes object.</li>
<li><A HREF="users_98.htm#308656">pthread_attr_getschedpolicy()</A> (Get Scheduling Policy) </li>
<li><A HREF="users_98.htm#308666">pthread_attr_getscope()</A> (Get Scheduling Scope) </li>
<li><A HREF="users_98.htm#308676">pthread_attr_getstackaddr()</A> (Get Stack Address) </li>
<li><A HREF="users_98.htm#308686">pthread_attr_getstacksize()</A> (Get Stack Size) </li>
<li><A HREF="users_g9.htm">pthread_attr_init()</A> (Initialize Thread Attributes Object) initializes a thread attributes object to the default thread attributes.</li>
<li><A HREF="users_10.htm">pthread_attr_setdetachstate()</A> (Set Thread Attributes Object Detachstate) sets the detach state of the thread attributes object.</li>
<li><A HREF="users_98.htm#308691">pthread_attr_setguardsize()</A> (Set Guard Size) </li>
<li><A HREF="users_11.htm">pthread_attr_setinheritsched()</A> (Set Thread Attribute Inherit Scheduling Attributes) sets the inheritsched attribute in the thread attributes object specified.</li>
<li><A HREF="users_12.htm">pthread_attr_setschedparam()</A> (Set Thread Attributes Object Scheduling Parameters) sets the scheduling parameters in the thread attributes object.</li>
<li><A HREF="users_98.htm#308696">pthread_attr_setschedpolicy()</A> (Set Scheduling Policy) </li>
<li><A HREF="users_98.htm#308706">pthread_attr_setscope()</A> (Set Scheduling Scope) </li>
<li><A HREF="users_98.htm#308716">pthread_attr_setstackaddr()</A> (Set Stack Address) </li>
<li><A HREF="users_98.htm#308726">pthread_attr_setstacksize()</A> (Set Stack Size) </li>
<li><A HREF="users_39.htm">pthread_cancel()</A> (Cancel Thread) requests cancellation of the target thread.</li>
<li><A HREF="users_40.htm">pthread_cleanup_peek_np()</A> (Copy Cleanup Handler from Cancellation Cleanup Stack) returns a copy of the cleanup handler entry that the next call to pthread_cleanup_pop() would pop.</li>
<li><A HREF="users_41.htm">pthread_cleanup_pop()</A> (Pop Cleanup Handler off of Cancellation Cleanup Stack) pops the last cleanup handler from the cancellation cleanup stack.</li>
<li><A HREF="users_42.htm">pthread_cleanup_push()</A> (Push Cleanup Handler onto Cancellation Cleanup Stack) pushes a cancellation cleanup routine onto the calling threads cancellation cleanup stack.</li>
<li><A HREF="users_13.htm">pthread_clear_exit_np()</A> (Clear Exit Status of Thread) clears the exit status of the thread.</li>
<li><A HREF="users_69.htm">pthread_condattr_destroy()</A> (Destroy Condition Variable Attributes Object) destroys the condition variable attributes object specified by attr, and indicates that any storage that the system has associated with the object be de-allocated.</li>
<li><A HREF="users_70.htm">pthread_condattr_getpshared()</A> (Get Process Shared Attribute from Condition Attributes Object) retrieves the current setting of the process shared attribute from the condition attributes object.</li>
<li><A HREF="users_71.htm">pthread_condattr_init()</A> (Initialize Condition Variable Attributes Object) initializes the condition variable attributes object specified by attr to the default attributes.</li>
<li><A HREF="users_72.htm">pthread_condattr_setpshared()</A> (Set Process Shared Attribute in Condition Attributes Object) sets the current pshared attribute for the condition attributes object.</li>
<li><A HREF="users_73.htm">pthread_cond_broadcast()</A> (Broadcast Condition to All Waiting Threads) wakes up all threads that are currently waiting on the condition variable specified by cond.</li>
<li><A HREF="users_74.htm">pthread_cond_destroy()</A> (Destroy Condition Variable) destroys the condition variable specified by cond.</li>
<li><A HREF="users_75.htm">pthread_cond_init()</A> (Initialize Condition Variable) initializes a condition variable object with the specified attributes for use.</li>
<li><A HREF="users_76.htm">pthread_cond_signal()</A> (Signal Condition to One Waiting Thread) wakes up at least one thread that is currently waiting on the condition variable specified by cond.</li>
<li><A HREF="users_77.htm">pthread_cond_timedwait()</A> (Timed Wait for Condition) blocks the calling thread, waiting for the condition specified by cond to be signaled or broadcast to.</li>
<li><A HREF="users_78.htm">pthread_cond_wait()</A> (Wait for Condition) blocks the calling thread, waiting for the condition specified by cond to be signaled or broadcast to.</li>
<li><A HREF="users_14.htm">pthread_create()</A> (Create Thread) creates a thread with the specified attributes and runs the C function start_routine in the thread with the single pointer argument specified.</li>
<li><A HREF="users_15.htm">pthread_delay_np()</A> (Delay Thread for Requested Interval) causes the calling thread to delay for the deltatime specified.</li>
<li><A HREF="users_16.htm">pthread_detach()</A> (Detach Thread) indicates that system resources for the specified thread should be reclaimed when the thread ends.</li>
<li><A HREF="users_17.htm">pthread_equal()</A> (Compare Two Threads) compares two Pthread handles for equality.</li>
<li><A HREF="users_18.htm">pthread_exit()</A> (Terminate Calling Thread) terminates the calling thread, making its exit status available to any waiting threads.</li>
<li><A HREF="users_19.htm">pthread_extendedjoin_np()</A> (Wait for Thread with Extended Options) waits for a thread to terminate, optionally detaches the thread, then returns the threads exit status.</li>
<li><A HREF="users_43.htm">pthread_getcancelstate_np()</A> (Get Cancel State) gets the current cancel state of the thread.</li>
<li><A HREF="users19b.htm">pthread_getconcurrency()</A> (Get Process Concurrency Level) retrieves the current concurrency level for the process.</li>
<li><A HREF="users_20.htm">pthread_getpthreadoption_np()</A> (Get Pthread Run-Time Option Data) gets option data from the pthread run-time for the process.</li>
<li><A HREF="users_21.htm">pthread_getschedparam()</A> (Get Thread Scheduling Parameters) retrieves the scheduling parameters of the thread.</li>
<li><A HREF="users_34.htm">pthread_getspecific()</A> (Get Thread Local Storage Value by Key) retrieves the thread local storage value associated with the key. pthread_getspecific() may be called from a data destructor.</li>
<li><A HREF="users_22.htm">pthread_getthreadid_np()</A> (Retrieve Unique ID for Calling Thread) retrieves the unique integral identifier that can be used to identify the calling thread in some context for application debugging or tracing support.</li>
<li><A HREF="users_23.htm">pthread_getunique_np()</A> (Retrieve a Unique ID for Target Thread) retrieves the unique integral identifier that can be used to identify the thread in some context for application debugging or tracing support.</li>
<li><A HREF="users_79.htm">pthread_get_expiration_np()</A> (Get Condition Expiration Time from Relative Time) computes an absolute time by adding the specified relative time (delta) to the current system time.</li>
<li><A HREF="users_99.htm">pthread_is_initialthread_np()</A> (Check if Running in the Initial Thread) returns true or false, indicating if the current thread is the initial thread of the process.</li>
<li><A HREF="users_24.htm">pthread_is_multithreaded_np()</A> (Check the Current Number of Threads) returns true or false, indicating whether the current process has more than one thread.</li>
<li><A HREF="users_25.htm">pthread_join()</A> (Wait for and Detach Thread) waits for a thread to terminate, detaches the thread, then returns the threads exit status.</li>
<li><A HREF="users_26.htm">pthread_join_np()</A> (Wait for Thread to End) waits for a thread to terminate, then returns the threads exit status, while leaving the data structures of the thread available for a later call to pthread_join(), pthread_join_np(), pthread_detach(), or pthread_extendedjoin_np()</li>
<li><A HREF="users_35.htm">pthread_key_create()</A> (Create Thread Local Storage Key) creates a thread local storage key for the process and associates the destructor function with that key.</li>
<li><A HREF="users_36.htm">pthread_key_delete()</A> (Delete Thread Local Storage Key) deletes a process-wide thread local storage key.</li>
<li><A HREF="users_95.htm">pthread_kill()</A> (Send Signal to Thread) requests that the signal sig be delivered to the specified thread.</li>
<li><A HREF="users_66.htm">pthread_lock_global_np()</A> (Lock Global Mutex) locks a global mutex provided by the pthreads run-time.</li>
<li><A HREF="users_49.htm">pthread_mutexattr_destroy()</A> (Destroy Mutex Attributes Object) destroys a mutex attributes object and allows the system to reclaim any resources associated with that mutex attributes object.</li>
<li><A HREF="users_50.htm">pthread_mutexattr_getkind_np()</A> (Get Mutex Kind Attribute) retrieves the kind attribute from the mutex attributes object specified by attr.</li>
<li><A HREF="users_51.htm">pthread_mutexattr_getname_np()</A> (Get Name from Mutex Attributes Object) retrieves the name attribute associated with the mutex attribute specified by attr.</li>
<li><A HREF="users_98.htm#308800">pthread_mutexattr_getprioceiling()</A> (Get Mutex Priority Ceiling Attribute) </li>
<li><A HREF="users_98.htm#308810">pthread_mutexattr_getprotocol()</A> (Get Mutex Protocol Attribute) </li>
<li><A HREF="users_52.htm">pthread_mutexattr_getpshared()</A> (Get Process Shared Attribute from Mutex Attributes Object) retrieves the current setting of the process shared attribute from the mutex attributes object.</li>
<li><A HREF="users_53.htm">pthread_mutexattr_gettype()</A> (Get Mutex Type Attribute) retrieves the type attribute from the mutex attributes object specified by attr.</li>
<li><A HREF="users_54.htm">pthread_mutexattr_init()</A> (Initialize Mutex Attributes Object) initializes the mutex attributes object referenced by attr to the default attributes.</li>
<li><A HREF="users_55.htm">pthread_mutexattr_setkind_np()</A> (Set Mutex Kind Attribute) sets the kind attribute in the mutex attributes object specified by attr.</li>
<li><A HREF="users_56.htm">pthread_mutexattr_setname_np()</A> (Set Name in Mutex Attributes Object) changes the name attribute associated with the mutex attribute specified by attr.</li>
<li><A HREF="users_98.htm#308820">pthread_mutexattr_setprioceiling()</A> (Set Mutex Priority Ceiling Attribute) </li>
<li><A HREF="users_98.htm#308830">pthread_mutexattr_setprotocol()</A> (Set Mutex Protocol Attribute) </li>
<li><A HREF="users_57.htm">pthread_mutexattr_setpshared()</A> (Set Process Shared Attribute in Mutex Attributes Object) sets the current pshared attribute for the mutex attributes object.</li>
<li><A HREF="users_58.htm">pthread_mutexattr_settype()</A> (Set Mutex Type Attribute) sets the type attribute in the mutex attributes object specified by attr.</li>
<li><A HREF="users_60.htm">pthread_mutex_destroy()</A> (Destroy Mutex) destroys the named mutex.</li>
<li><A HREF="users_98.htm#308840">pthread_mutex_getprioceiling()</A> (Get Mutex Priority Ceiling) </li>
<li><A HREF="users_61.htm">pthread_mutex_init()</A> (Initialize Mutex) initializes a mutex with the specified attributes for use.</li>
<li><A HREF="users_62.htm">pthread_mutex_lock()</A> (Lock Mutex) acquires ownership of the mutex specified.</li>
<li><A HREF="users_98.htm#308850">pthread_mutex_setprioceiling()</A> (Set Mutex Priority Ceiling) </li>
<li><A HREF="users_63.htm">pthread_mutex_timedlock_np()</A> (Lock Mutex with Time-Out) acquires ownership of the mutex specified.</li>
<li><A HREF="users_64.htm">pthread_mutex_trylock()</A> (Lock Mutex with No Wait) attempts to acquire ownership of the mutex specified without blocking the calling thread.</li>
<li><A HREF="users_65.htm">pthread_mutex_unlock()</A> (Unlock Mutex) unlocks the mutex specified.</li>
<li><A HREF="users_27.htm">pthread_once()</A> (Perform One-Time Initialization) performs one time initialization based on a specific once_control variable.</li>
<li><A HREF="users_81.htm">pthread_rwlockattr_destroy()</A> (Destroy Read/Write Lock Attribute) destroys a read/write lock attributes object and allows the systems to reclaim any resources associated with that read/write lock attributes object.</li>
<li><A HREF="users_82.htm">pthread_rwlockattr_getpshared()</A> (Get Pshared Read/Write Lock Attribute) retrieves the current setting of the process shared attribute from the read/write lock attributes object.</li>
<li><A HREF="users_83.htm">pthread_rwlockattr_init()</A> (Initialize Read/Write Lock Attribute) initializes the read/write lock attributes object referred to by attr to the default attributes.</li>
<li><A HREF="users_84.htm">pthread_rwlockattr_setpshared()</A> (Set Pshared Read/Write Lock Attribute) sets the current pshared attribute for the read/write attributes object.</li>
<li><A HREF="users_85.htm">pthread_rwlock_destroy()</A> (Destroy Read/Write Lock) destroys the named read/write lock.</li>
<li><A HREF="users_86.htm">pthread_rwlock_init()</A> (Initialize Read/Write Lock) initializes a new read/write lock with the specified attributes for use.</li>
<li><A HREF="users_87.htm">pthread_rwlock_rdlock()</A> (Get Shared Read Lock) attempts to acquire a shared read lock on the read/write lock specified by rwlock.</li>
<li><A HREF="users_88.htm">pthread_rwlock_timedrdlock_np()</A> (Get Shared Read Lock with Time-Out) attempts to acquire a shared read lock on the read/write lock specified by rwlock.</li>
<li><A HREF="users_89.htm">pthread_rwlock_timedwrlock_np()</A> (Get Exclusive Write Lock with Time-Out) attempts to acquire an exclusive write lock on the read/write lock specified by rwlock.</li>
<li><A HREF="users_90.htm">pthread_rwlock_tryrdlock()</A> (Get Shared Read Lock with No Wait) attempts to acquire a shared read lock on the read/write lock specified by rwlock.</li>
<li><A HREF="users_91.htm">pthread_rwlock_trywrlock()</A> (Get Exclusive Write Lock with No Wait) attempts to acquire an exclusive write lock on the read/write lock specified by rwlock.</li>
<li><A HREF="users_92.htm">pthread_rwlock_unlock()</A> (Unlock Exclusive Write or Shared Read Lock) unlocks a shared read or exclusive write lock held by the calling thread.</li>
<li><A HREF="users_93.htm">pthread_rwlock_wrlock()</A> (Get Exclusive Write Lock) attempts to acquire an exclusive write lock on the read/write lock specified by rwlock.</li>
<li><A HREF="users_28.htm">pthread_self()</A> (Get Pthread Handle) returns the Pthread handle of the calling thread.</li>
<li><A HREF="users_44.htm">pthread_setcancelstate()</A> (Set Cancel State) sets the cancel state to one of PTHREAD_CANCEL_ENABLE or PTHREAD_CANCEL_DISABLE and returns the old cancel state into the location specified by oldstate (if oldstate is non-NULL).</li>
<li><A HREF="users_45.htm">pthread_setcanceltype()</A> (Set Cancel Type) sets the cancel type to one of PTHREAD_CANCEL_DEFERRED or PTHREAD_CANCEL_ASYNCHRONOUS and returns the old cancel type into the location specified by oldtype (if oldtype is non-NULL)</li>
<li><A HREF="users_29.htm">pthread_setconcurrency()</A> (Set Process Concurrency Level) sets the current concurrency level for the process.</li>
<li><A HREF="users_30.htm">pthread_setpthreadoption_np()</A> (Set Pthread Run-Time Option Data) sets option data in the pthread run-time for the process.</li>
<li><A HREF="users_31.htm">pthread_setschedparam()</A> (Set Target Thread Scheduling Parameters) sets the scheduling parameters of the target thread.</li>
<li><A HREF="users_37.htm">pthread_setspecific()</A> (Set Thread Local Storage by Key) sets the thread local storage value associated with a key.</li>
<li><A HREF="users_59.htm">pthread_set_mutexattr_default_np()</A> (Set Default Mutex Attributes Object Kind Attribute) sets the kind attribute in the default mutex attribute object.</li>
<li><A HREF="users_96.htm">pthread_sigmask()</A> (Set or Get Signal Mask) examines or modifies the signal blocking mask for the current thread.</li>
<li><A HREF="users_97.htm">pthread_signal_to_cancel_np()</A> (Convert Signals to Cancel Requests) causes a pthread_cancel() to be delivered to the target thread when the first signal specified in set arrives.</li>
<li><A HREF="users_46.htm">pthread_testcancel()</A> (Create Cancellation Point) creates a cancellation point in the calling thread.</li>
<li><A HREF="users_47.htm">pthread_test_exit_np()</A> (Test Thread Exit Status) returns the current state of the thread along with its exit status.</li>
<li><A HREF="users_h1.htm">pthread_trace_init_np()</A> (Initialize or Reinitialize Pthread Tracing) initializes or refreshes both the Pthreads library trace level and the application trace level.</li>
<li><A HREF="users_h2.htm">PTHREAD_TRACE_NP()</A> (Execute Code Based on Trace Level (Macro)) is used to execute optional code based on the current application trace level.</li>
<li><A HREF="users_67.htm">pthread_unlock_global_np()</A> (Unlock Global Mutex) unlocks a global mutex provided by the pthreads run-time.</li>
<li><A HREF="users_32.htm">sched_yield()</A> (Yield Processor to Another Thread) yields the processor from the currently executing thread to another ready-to-run, active thread of equal or higher priority.</li>
</ul>
<!--***************API END PASTE***************-->
<hr>
<center>
<table cellpadding="2" cellspacing="2">
<tr align="center">
<td valign="middle" align="center">
<a href="#Top_Of_Page">Top</a> |
<a href="aplist.htm">APIs by category</a></td>
</tr>
</table>
</center>
</body>
</html>