source: rtems/cpukit/score/src/apimutexunlock.c @ 0daa8ab

5
Last change on this file since 0daa8ab was 8797c76, checked in by Sebastian Huber <sebastian.huber@…>, on 09/27/16 at 13:23:00

score: Unify CORE mutex seize/surrender

Use the Thread_Control::resource_count for the no protocol mutexes.
Merge the no protocol and priority inherit CORE mutex seize/surrender
operations.

  • Property mode set to 100644
File size: 1.2 KB
Line 
1/**
2 * @file
3 *
4 * @brief Releases the Specified API Mutex
5 *
6 * @ingroup ScoreAPIMutex
7 */
8
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#if HAVE_CONFIG_H
19#include "config.h"
20#endif
21
22#include <rtems/score/apimutex.h>
23#include <rtems/score/coremuteximpl.h>
24
25void _API_Mutex_Unlock( API_Mutex_Control *the_mutex )
26{
27  Thread_queue_Context queue_context;
28  Thread_Life_state    previous_thread_life_state;
29  bool                 restore_thread_life_protection;
30
31  previous_thread_life_state = the_mutex->previous_thread_life_state;
32  restore_thread_life_protection = the_mutex->Mutex.nest_level == 0;
33
34  _Thread_queue_Context_initialize( &queue_context );
35  _ISR_lock_ISR_disable( &queue_context.Lock_context.Lock_context );
36  _CORE_recursive_mutex_Surrender(
37    &the_mutex->Mutex,
38    CORE_MUTEX_TQ_PRIORITY_INHERIT_OPERATIONS,
39    _Thread_Executing,
40    &queue_context
41  );
42
43  if ( restore_thread_life_protection ) {
44    _Thread_Set_life_protection( previous_thread_life_state );
45  }
46}
Note: See TracBrowser for help on using the repository browser.