1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2<html> 3 4<head> 5<META http-equiv="Content-Type" content="text/html; charset=windows-1252"> 6<META name="GENERATOR" content="Microsoft FrontPage 5.0"> 7<META http-equiv="Content-Style-Type" content="text/css"> 8<LINK rel="stylesheet" type="text/css" href="../../CSS/revolution.css"> 9<title>OSLockMutex</title> 10</head> 11 12<body> 13 14<h1>OSLockMutex</h1> 15 16 17<h2>C Specification</h2> 18 19<dl> 20 <dd><pre><code>#include <revolution/os.h></code></pre> 21 </dd> 22 <dd><pre><code>void OSLockMutex(OSMutex* mutex);</code></pre> 23 </dd> 24</dl> 25 26<h2>Arguments</h2> 27<TABLE border="1" cellpadding="3" cellspacing="0.1"> 28 <tr> 29<TD width="120" bgcolor="#ffffe8"><i><b><code><STRONG><EM><CODE>mutex</CODE></EM></STRONG></code></b></i></TD> 30<TD width="520">Pointer to mutex.</TD> 31 </tr> 32</TABLE> 33<h2>Return Values</h2> 34 35<p>None.</p> 36 37<h2>Description</h2> 38 39<p>The calling thread tries to lock the <span class=spelle><span style='font-family:Arial'>mutex</span></span> specified by <code><b><i>mutex</i></b></code>.</p> 40 41<p>When <code><b><i>mutex</i></b></code> is being maintained by another thread, the calling thread is temporarily stopped until <code><b><i>mutex</i></b></code> is released. Note the fact that if the priority of the calling thread is higher than the thread that owns the mutex, the active priority of the thread that owns the mutex will be raised under the basic priority inheritance mechanism of the system.</p> 42 43<p>If <FONT face="Courier New"><EM><STRONG>mutex</STRONG></EM></FONT> is already saved for the current thread, unnecessary <code>OSLockMutex</code> function calls will return quickly. Note that each <code>OSUnlockMutex</code> function call must correspond to a <code>OSLockMutex</code> function call or the mutex will not be freed. This allows the safe nesting of multiple calls to <code>OSLockMutex</code> and <code>OSUnlockMutex</code> for the same mutex.</p> 44 45<p>This function may put the current thread to sleep. For precautions when calling similar functions, refer to <a href="../Interrupt/intro.html">Interrupts and Callback Functions</a>.</p> 46 47 48<h2>See Also</h2> 49 50<p><A href="../toc.html#Thread" target="contents">Thread Functions</A>, <A href="../toc.html#ThreadSynchronization" target="contents">Thread Synchronization Functions</A>,<br> <a href="OSInitCond.html"><code>OSInitCond</code></a>, <a href="OSInitMutex.html"><code>OSInitMutex</code></a>, <a href="OSSignalCond.html"><code>OSSignalCond</code></a>, <a href="OSTryLockMutex.html"><code>OSTryLockMutex</code></a>, <a href="OSUnlockMutex.html"><code>OSUnlockMutex</code></a>, <a href="OSWaitCond.html"><code>OSWaitCond</code></a>, <a href="../Interrupt/intro.html">Interrupts and Callback Functions</a></p> 51 52<h2>Revision History</h2><p></p> 53<p> 542007/09/25 Added information on the sleeping status of threads.<br>2006/03/01 Initial version.<br> 55</p> 56<hr><p>CONFIDENTIAL</p></body> 57</html>