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

84 lines
5.4 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>Condition variable synchronization 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>Condition variable synchronization APIs</h2>
<p>Condition variables are synchronization objects that allow threads to wait for certain events (conditions) to occur. Condition variables are slightly more complex than mutexes, and the correct use of condition variables requires the thread to co-operatively use a specific protocol in order to ensure safe and consistent serialization. The protocol for using condition variables includes a mutex, a boolean predicate (true/false expression) and the condition variable itself. The threads that are cooperating using condition variables can wait for a condition to occur, or can wake up other threads that are waiting for a condition.</p>
<p>The table below lists important conditional variables attributes, their default values, and all supported values.</p>
<table border width="80%">
<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="20%">pshared</td>
<td align="left" valign="top" width="40%"><strong>PTHREAD_PROCESS_PRIVATE</strong></td>
<td align="left" valign="top" width="40%"><strong>PTHREAD_PROCESS_PRIVATE</strong> or <strong>PTHREAD_PROCESS_SHARED</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 Condition variable synchronization 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_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_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_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>
</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>