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

58 lines
2.5 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>Mutexes return EDEADLK when re-locked by owner</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. -->
<!-- Change History: -->
<!-- YYMMDD USERID Change description -->
<!-- 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 -->
<!--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>
<h2>Mutexes return EDEADLK when re-locked by owner</h2>
<p>Some threads implementations return the EDEADLK error when a mutex attempts
to relock a mutex that it already owns. The POSIX standard specifies that the
results are undefined when a mutex is re-locked by the owner. The Single UNIX
Specification addresses these issues by providing a new mutex attribute called
<em>type</em>.</p>
<p>The iSeries threads support takes the same implementation route that the
Single UNIX Specification suggests, and it also causes the thread to deadlock
when it attempts to re-lock a normal (non-recursive) mutex. Because many users
of Pthreads do not check return codes from functions, the deadlock protects
applications from corrupted data that might result if they attempt to relock an
already held mutex, then unlock the mutex as if the lock was successful.</p>
<p>See <a href="users_53.htm#370578">pthread_mutexattr_gettype()--Get Mutex
Type Attribute</a> and <a href="users_58.htm#370784">
pthread_mutexattr_settype()--Set Mutex Type Attribute</a> if you need
error-checking mutexes for your application.</p>
<hr>
<center>
<table cellpadding="2" cellspacing="2">
<tr align="center">
<td valign="middle" align="center">
<a href="rzah4mst.htm">Pthread APIs</a> |
<a href="aplist.htm">APIs by category</a></td>
</tr>
</table>
</center>
</body>
</html>