1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Xenomai API: Mutex services.</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.5 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="main.html"><span>Main Page</span></a></li>
<li><a href="pages.html"><span>Related Pages</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li><a href="examples.html"><span>Examples</span></a></li>
<li>
<form action="search.php" method="get">
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td><label> <u>S</u>earch for </label></td>
<td><input type="text" name="query" value="" size="20" accesskey="s"/></td>
</tr>
</table>
</form>
</li>
</ul>
</div>
</div>
<div class="contents">
<h1>Mutex services.<br>
<small>
[<a class="el" href="group__native.html">Native Xenomai API.</a>]</small>
</h1>
<p>
<div class="dynheader">
Collaboration diagram for Mutex services.:</div>
<div class="dynsection">
<center><table><tr><td><img src="group__mutex.png" border="0" alt="" usemap="#group____mutex_map">
<map name="group____mutex_map">
<area shape="rect" href="group__native.html" title="Native Xenomai API." alt="" coords="5,6,149,30"></map></td></tr></table></center>
</div>
<hr><a name="_details"></a><h2>Detailed Description</h2>
Mutex services.<p>
A mutex is a MUTual EXclusion object, and is useful for protecting shared data structures from concurrent modifications, and implementing critical sections and monitors.<p>
A mutex has two possible states: unlocked (not owned by any task), and locked (owned by one task). A mutex can never be owned by two different tasks simultaneously. A task attempting to lock a mutex that is already locked by another task is blocked until the latter unlocks the mutex first.<p>
Xenomai mutex services enforce a priority inheritance protocol in order to solve priority inversions.
<p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Files</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><a class="el" href="ksrc_2skins_2native_2mutex_8c.html">mutex.c</a></td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">This file is part of the Xenomai project. <br></td></tr>
<p>
<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__mutex.html#gc89c13a781e4636acf9e66f02d9feb83">rt_mutex_create</a> (RT_MUTEX *mutex, const char *name)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Create a mutex. <a href="#gc89c13a781e4636acf9e66f02d9feb83"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__mutex.html#gd0c2342227f821bd09f580b6a9684179">rt_mutex_delete</a> (RT_MUTEX *mutex)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Delete a mutex. <a href="#gd0c2342227f821bd09f580b6a9684179"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__mutex.html#g8a087d5bfeaaf10b6f0a924b272d72c9">rt_mutex_acquire</a> (RT_MUTEX *mutex, RTIME timeout)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Acquire a mutex. <a href="#g8a087d5bfeaaf10b6f0a924b272d72c9"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__mutex.html#gc87911b7279f55ef2f5f9aefe36ff070">rt_mutex_release</a> (RT_MUTEX *mutex)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Unlock mutex. <a href="#gc87911b7279f55ef2f5f9aefe36ff070"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__mutex.html#g8f7db304bb5a839d81614f00c4cde145">rt_mutex_inquire</a> (RT_MUTEX *mutex, RT_MUTEX_INFO *info)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Inquire about a mutex. <a href="#g8f7db304bb5a839d81614f00c4cde145"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__mutex.html#g39b3a0e7f6f6ee41b8068ed59e25d1d1">rt_mutex_bind</a> (RT_MUTEX *mutex, const char *name, RTIME timeout)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Bind to a mutex. <a href="#g39b3a0e7f6f6ee41b8068ed59e25d1d1"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">static int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__mutex.html#g3f308046a8fb83442d5d97e33d0516a4">rt_mutex_unbind</a> (RT_MUTEX *mutex)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Unbind from a mutex. <a href="#g3f308046a8fb83442d5d97e33d0516a4"></a><br></td></tr>
</table>
<hr><h2>Function Documentation</h2>
<a class="anchor" name="g8a087d5bfeaaf10b6f0a924b272d72c9"></a><!-- doxytag: member="mutex.c::rt_mutex_acquire" ref="g8a087d5bfeaaf10b6f0a924b272d72c9" args="(RT_MUTEX *mutex, RTIME timeout)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int rt_mutex_acquire </td>
<td>(</td>
<td class="paramtype">RT_MUTEX * </td>
<td class="paramname"> <em>mutex</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">RTIME </td>
<td class="paramname"> <em>timeout</em></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Acquire a mutex.
<p>
Attempt to lock a mutex. The calling task is blocked until the mutex is available, in which case it is locked again before this service returns. Mutexes have an ownership property, which means that their current owner is tracked. Xenomai mutexes are implicitely recursive and implement the priority inheritance protocol.<p>
Since a nested locking count is maintained for the current owner, <a class="el" href="group__mutex.html#g8a087d5bfeaaf10b6f0a924b272d72c9" title="Acquire a mutex.">rt_mutex_acquire()</a> and <a class="el" href="group__mutex.html#gc87911b7279f55ef2f5f9aefe36ff070" title="Unlock mutex.">rt_mutex_release()</a> must be used in pairs.<p>
Tasks pend on mutexes by priority order.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>mutex</em> </td><td>The descriptor address of the mutex to acquire.</td></tr>
<tr><td valign="top"></td><td valign="top"><em>timeout</em> </td><td>The number of clock ticks to wait for the mutex to be available to the calling task (see note). Passing TM_INFINITE causes the caller to block indefinitely until the mutex is available. Passing TM_NONBLOCK causes the service to return immediately without waiting if the mutex is still locked by another task.</td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 is returned upon success. Otherwise:</dd></dl>
<ul>
<li>-EINVAL is returned if <em>mutex</em> is not a mutex descriptor.</li></ul>
<p>
<ul>
<li>-EIDRM is returned if <em>mutex</em> is a deleted mutex descriptor, including if the deletion occurred while the caller was sleeping on it.</li></ul>
<p>
<ul>
<li>-EWOULDBLOCK is returned if <em>timeout</em> is equal to TM_NONBLOCK and the mutex is not immediately available.</li></ul>
<p>
<ul>
<li>-EINTR is returned if <a class="el" href="group__task.html#g770281eeca009c0a08a7c4a9fd849ac1" title="Unblock a real-time task.">rt_task_unblock()</a> has been called for the waiting task before the mutex has become available.</li></ul>
<p>
<ul>
<li>-ETIMEDOUT is returned if the mutex cannot be made available to the calling task within the specified amount of time.</li></ul>
<p>
<ul>
<li>-EPERM is returned if this service was called from a context which cannot be given the ownership of the mutex (e.g. interrupt, non-realtime or scheduler locked).</li></ul>
<p>
Environments:<p>
This service can be called from:<p>
<ul>
<li>Kernel-based task</li><li>User-space task (switches to primary mode)</li></ul>
<p>
Rescheduling: always unless the request is immediately satisfied or <em>timeout</em> specifies a non-blocking operation. If the caller is blocked, the current owner's priority might be temporarily raised as a consequence of the priority inheritance protocol.<p>
<dl class="note" compact><dt><b>Note:</b></dt><dd>The <em>timeout</em> value will be interpreted as jiffies if the native skin is bound to a periodic time base (see CONFIG_XENO_OPT_NATIVE_PERIOD), or nanoseconds otherwise. </dd></dl>
<p>References <a class="el" href="include_2nucleus_2thread_8h-source.html#l00112">XNBREAK</a>, <a class="el" href="include_2nucleus_2thread_8h-source.html#l00111">XNRMID</a>, <a class="el" href="synch_8c-source.html#l00168">xnsynch_sleep_on()</a>, and <a class="el" href="include_2nucleus_2thread_8h-source.html#l00110">XNTIMEO</a>.</p>
<p>Referenced by <a class="el" href="ksrc_2skins_2native_2cond_8c-source.html#l00442">rt_cond_wait()</a>.</p>
</div>
</div><p>
<a class="anchor" name="g39b3a0e7f6f6ee41b8068ed59e25d1d1"></a><!-- doxytag: member="mutex.h::rt_mutex_bind" ref="g39b3a0e7f6f6ee41b8068ed59e25d1d1" args="(RT_MUTEX *mutex, const char *name, RTIME timeout)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int rt_mutex_bind </td>
<td>(</td>
<td class="paramtype">RT_MUTEX * </td>
<td class="paramname"> <em>mutex</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char * </td>
<td class="paramname"> <em>name</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">RTIME </td>
<td class="paramname"> <em>timeout</em></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Bind to a mutex.
<p>
This user-space only service retrieves the uniform descriptor of a given Xenomai mutex identified by its symbolic name. If the mutex does not exist on entry, this service blocks the caller until a mutex of the given name is created.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>name</em> </td><td>A valid NULL-terminated name which identifies the mutex to bind to.</td></tr>
<tr><td valign="top"></td><td valign="top"><em>mutex</em> </td><td>The address of a mutex descriptor retrieved by the operation. Contents of this memory is undefined upon failure.</td></tr>
<tr><td valign="top"></td><td valign="top"><em>timeout</em> </td><td>The number of clock ticks to wait for the registration to occur (see note). Passing TM_INFINITE causes the caller to block indefinitely until the object is registered. Passing TM_NONBLOCK causes the service to return immediately without waiting if the object is not registered on entry.</td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 is returned upon success. Otherwise:</dd></dl>
<ul>
<li>-EFAULT is returned if <em>mutex</em> or <em>name</em> is referencing invalid memory.</li></ul>
<p>
<ul>
<li>-EINTR is returned if <a class="el" href="group__task.html#g770281eeca009c0a08a7c4a9fd849ac1" title="Unblock a real-time task.">rt_task_unblock()</a> has been called for the waiting task before the retrieval has completed.</li></ul>
<p>
<ul>
<li>-EWOULDBLOCK is returned if <em>timeout</em> is equal to TM_NONBLOCK and the searched object is not registered on entry.</li></ul>
<p>
<ul>
<li>-ETIMEDOUT is returned if the object cannot be retrieved within the specified amount of time.</li></ul>
<p>
<ul>
<li>-EPERM is returned if this service should block, but was called from a context which cannot sleep (e.g. interrupt, non-realtime or scheduler locked).</li></ul>
<p>
Environments:<p>
This service can be called from:<p>
<ul>
<li>User-space task (switches to primary mode)</li></ul>
<p>
Rescheduling: always unless the request is immediately satisfied or <em>timeout</em> specifies a non-blocking operation.<p>
<dl class="note" compact><dt><b>Note:</b></dt><dd>The <em>timeout</em> value will be interpreted as jiffies if the native skin is bound to a periodic time base (see CONFIG_XENO_OPT_NATIVE_PERIOD), or nanoseconds otherwise. </dd></dl>
</div>
</div><p>
<a class="anchor" name="gc89c13a781e4636acf9e66f02d9feb83"></a><!-- doxytag: member="mutex.c::rt_mutex_create" ref="gc89c13a781e4636acf9e66f02d9feb83" args="(RT_MUTEX *mutex, const char *name)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int rt_mutex_create </td>
<td>(</td>
<td class="paramtype">RT_MUTEX * </td>
<td class="paramname"> <em>mutex</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char * </td>
<td class="paramname"> <em>name</em></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Create a mutex.
<p>
Create a mutual exclusion object that allows multiple tasks to synchronize access to a shared resource. A mutex is left in an unlocked state after creation.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>mutex</em> </td><td>The address of a mutex descriptor Xenomai will use to store the mutex-related data. This descriptor must always be valid while the mutex is active therefore it must be allocated in permanent memory.</td></tr>
<tr><td valign="top"></td><td valign="top"><em>name</em> </td><td>An ASCII string standing for the symbolic name of the mutex. When non-NULL and non-empty, this string is copied to a safe place into the descriptor, and passed to the registry package if enabled for indexing the created mutex.</td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 is returned upon success. Otherwise:</dd></dl>
<ul>
<li>-ENOMEM is returned if the system fails to get enough dynamic memory from the global real-time heap in order to register the mutex.</li></ul>
<p>
<ul>
<li>-EEXIST is returned if the <em>name</em> is already in use by some registered object.</li></ul>
<p>
<ul>
<li>-EPERM is returned if this service was called from an asynchronous context.</li></ul>
<p>
Environments:<p>
This service can be called from:<p>
<ul>
<li>Kernel module initialization/cleanup code</li><li>Kernel-based task</li><li>User-space task</li></ul>
<p>
Rescheduling: possible.
<p>References <a class="el" href="src_2skins_2native_2mutex_8c-source.html#l00036">rt_mutex_delete()</a>, <a class="el" href="nucleus_2registry_8c-source.html#l00582">xnregistry_enter()</a>, and <a class="el" href="synch_8c-source.html#l00087">xnsynch_init()</a>.</p>
</div>
</div><p>
<a class="anchor" name="gd0c2342227f821bd09f580b6a9684179"></a><!-- doxytag: member="mutex.c::rt_mutex_delete" ref="gd0c2342227f821bd09f580b6a9684179" args="(RT_MUTEX *mutex)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int rt_mutex_delete </td>
<td>(</td>
<td class="paramtype">RT_MUTEX * </td>
<td class="paramname"> <em>mutex</em> </td>
<td> ) </td>
<td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Delete a mutex.
<p>
Destroy a mutex and release all the tasks currently pending on it. A mutex exists in the system since <a class="el" href="group__mutex.html#gc89c13a781e4636acf9e66f02d9feb83" title="Create a mutex.">rt_mutex_create()</a> has been called to create it, so this service must be called in order to destroy it afterwards.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>mutex</em> </td><td>The descriptor address of the affected mutex.</td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 is returned upon success. Otherwise:</dd></dl>
<ul>
<li>-EINVAL is returned if <em>mutex</em> is not a mutex descriptor.</li></ul>
<p>
<ul>
<li>-EIDRM is returned if <em>mutex</em> is a deleted mutex descriptor.</li></ul>
<p>
<ul>
<li>-EPERM is returned if this service was called from an asynchronous context.</li></ul>
<p>
Environments:<p>
This service can be called from:<p>
<ul>
<li>Kernel module initialization/cleanup code</li><li>Kernel-based task</li><li>User-space task</li></ul>
<p>
Rescheduling: possible.
<p>References <a class="el" href="pod_8c-source.html#l02377">xnpod_schedule()</a>, and <a class="el" href="nucleus_2registry_8c-source.html#l00807">xnregistry_remove()</a>.</p>
<p>Referenced by <a class="el" href="ksrc_2skins_2native_2mutex_8c-source.html#l00165">rt_mutex_create()</a>.</p>
</div>
</div><p>
<a class="anchor" name="g8f7db304bb5a839d81614f00c4cde145"></a><!-- doxytag: member="mutex.c::rt_mutex_inquire" ref="g8f7db304bb5a839d81614f00c4cde145" args="(RT_MUTEX *mutex, RT_MUTEX_INFO *info)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int rt_mutex_inquire </td>
<td>(</td>
<td class="paramtype">RT_MUTEX * </td>
<td class="paramname"> <em>mutex</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">RT_MUTEX_INFO * </td>
<td class="paramname"> <em>info</em></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Inquire about a mutex.
<p>
Return various information about the status of a given mutex.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>mutex</em> </td><td>The descriptor address of the inquired mutex.</td></tr>
<tr><td valign="top"></td><td valign="top"><em>info</em> </td><td>The address of a structure the mutex information will be written to.</td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 is returned and status information is written to the structure pointed at by <em>info</em> upon success. Otherwise:</dd></dl>
<ul>
<li>-EINVAL is returned if <em>mutex</em> is not a mutex descriptor.</li></ul>
<p>
<ul>
<li>-EIDRM is returned if <em>mutex</em> is a deleted mutex descriptor.</li></ul>
<p>
Environments:<p>
This service can be called from:<p>
<ul>
<li>Kernel module initialization/cleanup code</li><li>Interrupt service routine</li><li>Kernel-based task</li><li>User-space task</li></ul>
<p>
Rescheduling: never.
</div>
</div><p>
<a class="anchor" name="gc87911b7279f55ef2f5f9aefe36ff070"></a><!-- doxytag: member="mutex.c::rt_mutex_release" ref="gc87911b7279f55ef2f5f9aefe36ff070" args="(RT_MUTEX *mutex)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int rt_mutex_release </td>
<td>(</td>
<td class="paramtype">RT_MUTEX * </td>
<td class="paramname"> <em>mutex</em> </td>
<td> ) </td>
<td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Unlock mutex.
<p>
Release a mutex. If the mutex is pended, the first waiting task (by priority order) is immediately unblocked and transfered the ownership of the mutex; otherwise, the mutex is left in an unlocked state.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>mutex</em> </td><td>The descriptor address of the released mutex.</td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 is returned upon success. Otherwise:</dd></dl>
<ul>
<li>-EINVAL is returned if <em>mutex</em> is not a mutex descriptor.</li></ul>
<p>
<ul>
<li>-EIDRM is returned if <em>mutex</em> is a deleted mutex descriptor.</li></ul>
<p>
<ul>
<li>-EPERM is returned if <em>mutex</em> is not owned by the current task, or more generally if this service was called from a context which cannot own any mutex (e.g. interrupt, or non-realtime context).</li></ul>
<p>
Environments:<p>
This service can be called from:<p>
<ul>
<li>Kernel-based task</li><li>User-space task (switches to primary mode)</li></ul>
<p>
Rescheduling: possible.
<p>References <a class="el" href="pod_8c-source.html#l02377">xnpod_schedule()</a>, and <a class="el" href="synch_8c-source.html#l00376">xnsynch_wakeup_one_sleeper()</a>.</p>
</div>
</div><p>
<a class="anchor" name="g3f308046a8fb83442d5d97e33d0516a4"></a><!-- doxytag: member="mutex.h::rt_mutex_unbind" ref="g3f308046a8fb83442d5d97e33d0516a4" args="(RT_MUTEX *mutex)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int rt_mutex_unbind </td>
<td>(</td>
<td class="paramtype">RT_MUTEX * </td>
<td class="paramname"> <em>mutex</em> </td>
<td> ) </td>
<td width="100%"><code> [inline, static]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Unbind from a mutex.
<p>
This user-space only service unbinds the calling task from the mutex object previously retrieved by a call to <a class="el" href="group__mutex.html#g39b3a0e7f6f6ee41b8068ed59e25d1d1" title="Bind to a mutex.">rt_mutex_bind()</a>.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>mutex</em> </td><td>The address of a mutex descriptor to unbind from.</td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 is always returned.</dd></dl>
This service can be called from:<p>
<ul>
<li>User-space task.</li></ul>
<p>
Rescheduling: never.
</div>
</div><p>
</div>
<hr size="1"><address style="text-align: right;"><small>Generated on Sun Jun 8 18:08:51 2008 for Xenomai API by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.5 </small></address>
</body>
</html>
|