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

88 lines
5.6 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>Read/write lock 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>Read/write lock synchronization APIs</h2>
<p>Read/write locks help you build more complex applications without using mutexes and condition variables to provide your own read/write locking primitive object. Read/Write locks provide a synchronization mechanism that allow threads in an application to more accurately reflect the type of access to a shared resource that they require.</p>
<p>Many threads can acquire the same read/write lock if they acquire a shared read lock on the read/write lock object. Only one thread can acquire an exclusive write lock on a read/write lock object. When an exclusive write lock is held, no other threads are allowed to hold any lock.</p>
<p>The table below lists important read/write lock 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 Read/write lock 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_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_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>
</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>