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

132 lines
10 KiB
HTML
Raw Normal View History

2024-04-02 14:02:31 +00:00
<!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>Thread management APIs</title>
<!-- 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. -->
<!-- Begin Header Records ========================================== -->
<!-- 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 -->
<!-- 031112 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>
<!-- Java sync-link -->
<script language="Javascript" src="../rzahg/synch.js" type="text/javascript">
</script>
<a name="Top_Of_Page"></a>
<h2>Thread management APIs</h2>
<p>Thread management APIs allow a program to manipulate threads. The APIs actually create, destroy and otherwise manage the active or ended threads within the application. The APIs allow the manipulation of some of the thread attributes of an active thread.</p>
<p>A program can also setup or change the characteristics of a thread attributes object. The thread attributes object is used at thread creation time. The new thread is created with the attributes that are specified in the attributes object. After the thread has been created, the attributes object is no longer required.</p>
<p>The table below lists important thread attributes, their default values, and all supported values.</p>
<table border width="90%" cellpadding="5">
<tr>
<th valign="top">Attribute</th>
<th valign="top">Default value</th>
<th valign="top">Supported values</th>
</tr>
<tr>
<td align="left" valign="top" width="15%">detachstate</td>
<td align="left" valign="top" width="40%"><strong>PTHREAD_CREATE_JOINABLE</strong></td>
<td align="left" valign="top" width="45%"><strong>PTHREAD_CREATE_JOINABLE</strong><br> <strong>PTHREAD_CREATE_DETACHED</strong></td>
</tr>
<tr>
<td align="left" valign="top" width="15%">schedparam</td>
<td align="left" valign="top" width="40%"><strong>SCHED_OTHER</strong> with priority equal to <strong>PRIORITY_DEFAULT</strong> (0)</td>
<td align="left" valign="top" width="45%"><strong>SCHED_OTHER</strong> with priority &lt;= <strong>PTHREAD_PRIO_MAX</strong> and priority &gt;= <strong>PTHREAD_PRIO_MIN</strong></td>
</tr>
<tr>
<td align="left" valign="top" width="15%">contentionscope</td>
<td align="left" valign="top" width="40%"><strong>PTHREAD_SCOPE_SYSTEM</strong></td>
<td align="left" valign="top" width="45%">PTHREAD_SCOPE_SYSTEM</td>
</tr>
<tr>
<td align="left" valign="top" width="15%">inheritsched</td>
<td align="left" valign="top" width="40%"><strong>PTHREAD_EXPLICIT_SCHED</strong>, priority equal <strong>PRIORITY_DEFAULT</strong> (0)</td>
<td align="left" valign="top" width="45%"><strong>PTHREAD_EXPLICIT_SCHED</strong> or <strong>PTHREAD_INHERIT_SCHED</strong></td>
</tr>
<tr>
<td align="left" valign="top" width="15%">schedpolicy</td>
<td align="left" valign="top" width="40%"><strong>SCHED_OTHER</strong></td>
<td align="left" valign="top" width="45%"><strong>SCHED_OTHER</strong></td>
</tr>
</table>
<p>For information about the examples included with the APIs, see the <a href="users_g3.htm">information on the API examples</a>.</p>
<p>The thread management APIs are:</p>
<!-- ***** NOTE ***** Do not manually update text or links in this section. -->
<!-- Updates made in this section *will* be overlaid by automated tools -->
<!-- Notify User Technologies of needed updates to be made in XML for API finder.-->
<!--***************API BEGIN PASTE***************-->
<ul>
<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_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_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_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_13.htm">pthread_clear_exit_np()</A> (Clear Exit Status of Thread) clears the exit status of the thread.</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="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_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_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_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_28.htm">pthread_self()</A> (Get Pthread Handle) returns the Pthread handle of the calling thread.</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_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_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="rzah4mst.htm">Pthread APIs</a> |
<a href="aplist.htm">APIs by category</a></td>
</tr>
</table>
</center>
</body>
</html>