RTEMS
apimutexunlock.c
Go to the documentation of this file.
1 
9 /*
10  * COPYRIGHT (c) 1989-2007.
11  * On-Line Applications Research Corporation (OAR).
12  *
13  * The license and distribution terms for this file may be
14  * found in the file LICENSE in this distribution or at
15  * http://www.rtems.org/license/LICENSE.
16  */
17 
18 #ifdef HAVE_CONFIG_H
19 #include "config.h"
20 #endif
21 
22 #include <rtems/score/apimutex.h>
23 #include <rtems/score/threadimpl.h>
24 
26 {
27  Thread_Life_state previous_thread_life_state;
28  bool restore_thread_life_protection;
29 
30  previous_thread_life_state = the_mutex->previous_thread_life_state;
31  restore_thread_life_protection = the_mutex->Mutex._nest_level == 0;
32 
33  _Mutex_recursive_Release( &the_mutex->Mutex );
34 
35  if ( restore_thread_life_protection ) {
36  _Thread_Set_life_protection( previous_thread_life_state );
37  }
38 }
Thread_Life_state
Thread life states.
Definition: thread.h:672
Thread_Life_state _Thread_Set_life_protection(Thread_Life_state state)
Set the thread to life protected.
API Mutex Handler API.
void _API_Mutex_Unlock(API_Mutex_Control *the_mutex)
Releases the specified API mutex.
Thread_Life_state previous_thread_life_state
The thread life protection state before the outer-most mutex obtain.
Definition: apimutex.h:52
Inlined Routines from the Thread Handler.
Control block used to manage each API mutex.
Definition: apimutex.h:42
struct _Mutex_recursive_Control Mutex
Definition: apimutex.h:46