source: rtems/cpukit/score/src/apimutexlock.c @ 0b713f89

5
Last change on this file since 0b713f89 was 0b713f89, checked in by Sebastian Huber <sebastian.huber@…>, on 05/30/16 at 04:59:55

score: Rework CORE inherit priority mutex

Provide dedicated seize and surrender methods for inherit priority
mutexes. This eliminates CORE_mutex_Attributes.

  • Property mode set to 100644
File size: 1.1 KB
Line 
1/**
2 * @file
3 *
4 * @brief Acquires 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#include <rtems/score/threadimpl.h>
25
26void _API_Mutex_Lock( API_Mutex_Control *the_mutex )
27{
28  Thread_Life_state    previous_thread_life_state;
29  Thread_queue_Context queue_context;
30
31  previous_thread_life_state =
32    _Thread_Set_life_protection( THREAD_LIFE_PROTECTED );
33
34  _Thread_queue_Context_initialize( &queue_context );
35  _ISR_lock_ISR_disable( &queue_context.Lock_context );
36
37  _CORE_recursive_mutex_Seize(
38    &the_mutex->Mutex,
39    _Thread_Executing,
40    true,
41    WATCHDOG_NO_TIMEOUT,
42    _CORE_recursive_mutex_Seize_nested,
43    &queue_context
44  );
45
46  if ( the_mutex->Mutex.nest_level == 0 ) {
47    the_mutex->previous_thread_life_state = previous_thread_life_state;
48  }
49}
Note: See TracBrowser for help on using the repository browser.