111 lines
7.4 KiB
HTML
111 lines
7.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>Mutex 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>Mutex synchronization APIs</h2>
|
||
|
|
||
|
<p>Thread synchronization is required whenever two threads share a resource or need to be aware of what the other threads in a process are doing. Mutexes are the most simple and primitive object used for the co-operative mutual exclusion required to share and protect resources. One thread owns a mutex by locking it successfully, when another thread tries to lock the mutex, that thread will not be allowed to successfully lock the mutex until the owner unlocks it. The mutex support provides different types and behaviors for mutexes that can be tuned to your application requirements.</p>
|
||
|
|
||
|
<p>The table below lists important mutex attributes, their default values, and all supported values.</p>
|
||
|
|
||
|
<table border width="90%">
|
||
|
<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 or PTHREAD_PROCESS_SHARED</strong></td>
|
||
|
</tr>
|
||
|
|
||
|
<tr>
|
||
|
<td align="left" valign="top" width="20%">kind (non portable)</td>
|
||
|
<td align="left" valign="top" width="40%"><strong>PTHREAD_MUTEX_NONRECURSIVE_NP</strong></td>
|
||
|
<td align="left" valign="top" width="40%"><strong>PTHREAD_MUTEX_NONRECURSIVE_NP</strong> or <strong>PTHREAD_MUTEX_RECURSIVE_NP</strong></td>
|
||
|
</tr>
|
||
|
|
||
|
<tr>
|
||
|
<td align="left" valign="top" width="20%">name (non portable)</td>
|
||
|
<td align="left" valign="top" width="40%"><strong>PTHREAD_DEFAULT_MUTEX_NAME_NP</strong> "QP0WMTX UNNAMED"</td>
|
||
|
<td align="left" valign="top" width="40%">Any name that is 15 characters or less. If not terminated by a null character, name is truncated to 15 characters.</td>
|
||
|
</tr>
|
||
|
|
||
|
<tr>
|
||
|
<td align="left" valign="top" width="20%">type</td>
|
||
|
<td align="left" valign="top" width="40%"><strong>PTHREAD_MUTEX_DEFAULT</strong><br> (<strong>PTHREAD_MUTEX_NORMAL</strong>)</td>
|
||
|
<td align="left" valign="top" width="40%"><strong>PTHREAD_MUTEX_DEFAULT</strong> or <strong>PTHREAD_MUTEX_NORMAL</strong> or <strong>PTHREAD_MUTEX_RECURSIVE</strong> or <strong>PTHREAD_MUTEX_ERRORCHECK</strong> or <strong>PTHREAD_MUTEX_OWNERTERM_NP</strong> <br><br>
|
||
|
The <strong>PTHREAD_MUTEX_OWNERTERM_NP</strong> attribute value is non portable.</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 Mutex 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_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_60.htm">pthread_mutex_destroy()</A> (Destroy Mutex) destroys the named mutex.</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_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_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_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_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_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_67.htm">pthread_unlock_global_np()</A> (Unlock Global Mutex) unlocks a global mutex provided by the pthreads run-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>
|