RTEMS
apimutexlock.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 
29  previous_thread_life_state =
30  _Thread_Set_life_protection( THREAD_LIFE_PROTECTED );
31 
32  _Mutex_recursive_Acquire( &the_mutex->Mutex );
33 
34  if ( the_mutex->Mutex._nest_level == 0 ) {
35  the_mutex->previous_thread_life_state = previous_thread_life_state;
36  }
37 }
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.
void _API_Mutex_Lock(API_Mutex_Control *the_mutex)
Acquires the specified API mutex.
Definition: apimutexlock.c:25
API Mutex Handler API.
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