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="IBM WebSphere Studio Homepage Builder Version 7.0.1.0 for Windows">
7<META http-equiv="Content-Style-Type" content="text/css">
8<title>OS_LockMutex</title>
9<LINK rel="stylesheet" href="../../css/nitro.css" type="text/css">
10</head>
11
12<body>
13
14<h1 align="left">OS_LockMutex <IMG src="../../image/NTR.gif" align="middle"><IMG src="../../image/TWL.gif" align="middle"></h1>
15<h2>Syntax</h2>
16
17<dl>
18  <dd>
19<CODE>#include &lt;nitro/os.h&gt;</CODE><BR> <BR> <CODE>void OS_LockMutex( OSMutex* mutex );</CODE></dd>
20</dl>
21
22
23<h2>Arguments</h2>
24<TABLE border="1" width="100%">
25  <TBODY>
26    <TR>
27<TD width="13%"><EM><STRONG>mutex</STRONG></EM></TD>
28<TD width="87%">Pointer to the <CODE>OSMutex</CODE> structure</TD>
29    </TR>
30  </TBODY>
31</TABLE>
32
33<h2>Return Values</h2>
34<p>None.</p>
35
36<H2>Description</H2>
37<P>The calling thread tries to lock the mutex specified by <code>mutex</code>.</P>
38<P>When <code>mutex</code> is being maintained by another thread, the calling thread is temporarily stopped until <code>mutex</code> is released. If <code>mutex</code> is being maintained in the current thread, it returns immediately. However, the number of times the <CODE>OS_LockMutex</CODE> function is called is recorded, and <CODE>mutex</CODE> must be unlocked the same number of times to actually release it.</P>
39<P>When the thread that is locking <CODE>mutex</CODE> is ended by the <A href="../thread/OS_ExitThread.html"><CODE>OS_ExitThread</CODE></A> function, that mutex is automatically unlocked.</P>
40<h2>See Also</h2>
41<p><a href="OS_InitMutex.html"><CODE>OS_InitMutex</CODE></a><BR> <a href="OS_UnlockMutex.html"><CODE>OS_UnlockMutex</CODE></a><BR> <a href="OS_TryLockMutex.html"><CODE>OS_TryLockMutex</CODE></a><BR> <a href="../thread/OS_ExitThread.html"><CODE>OS_ExitThread</CODE></a></p>
42<H2>Revision History</H2>
43<P>2004/04/05 Added that the <A href="../thread/OS_ExitThread.html"><CODE>OS_ExitThread</CODE></A> function will unlock mutexes.<BR> 2003/12/01 Initial version.</P>
44<hr><p>CONFIDENTIAL</p></body>
45</html>
46