source: rtems/cpukit/score/src/apimutexunlock.c @ 1506658c

5
Last change on this file since 1506658c was 4438ac25, checked in by Sebastian Huber <sebastian.huber@…>, on 05/02/15 at 12:27:24

score: Fine grained locking for mutexes

Update #2273.

  • Property mode set to 100644
File size: 1.1 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  ISR_lock_Context lock_context;
28  bool             previous_thread_life_protection;
29  bool             restore_thread_life_protection;
30
31  previous_thread_life_protection =
32    the_mutex->previous_thread_life_protection;
33  restore_thread_life_protection = the_mutex->Mutex.nest_count == 1;
34
35  _ISR_lock_ISR_disable( &lock_context );
36  _CORE_mutex_Surrender(
37    &the_mutex->Mutex,
38    the_mutex->Object.id,
39    NULL,
40    &lock_context
41  );
42
43  if ( restore_thread_life_protection ) {
44    _Thread_Set_life_protection( previous_thread_life_protection );
45  }
46}
Note: See TracBrowser for help on using the repository browser.