source: rtems/cpukit/score/src/coremutexseize.c @ c499856

4.115
Last change on this file since c499856 was c499856, checked in by Chris Johns <chrisj@…>, on 03/20/14 at 21:10:47

Change all references of rtems.com to rtems.org.

  • Property mode set to 100644
File size: 1.5 KB
Line 
1/**
2 *  @file
3 *
4 *  @brief Seize Mutex with Blocking
5 *  @ingroup ScoreMutex
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2006.
10 *  On-Line Applications Research Corporation (OAR).
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.rtems.org/license/LICENSE.
15 */
16
17#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <rtems/system.h>
22#include <rtems/score/isr.h>
23#include <rtems/score/coremuteximpl.h>
24#include <rtems/score/schedulerimpl.h>
25#include <rtems/score/thread.h>
26
27#if defined(__RTEMS_DO_NOT_INLINE_CORE_MUTEX_SEIZE__)
28void _CORE_mutex_Seize(
29  CORE_mutex_Control  *_the_mutex,
30  Thread_Control      *_executing,
31  Objects_Id           _id,
32  bool                 _wait,
33  Watchdog_Interval    _timeout,
34  ISR_Level            _level
35)
36{
37  _CORE_mutex_Seize_body(
38    _the_mutex,
39    _executing,
40    _id,
41    _wait,
42    _timeout,
43    _level
44  );
45}
46#endif
47
48void _CORE_mutex_Seize_interrupt_blocking(
49  CORE_mutex_Control  *the_mutex,
50  Thread_Control      *executing,
51  Watchdog_Interval    timeout
52)
53{
54
55  if ( _CORE_mutex_Is_inherit_priority( &the_mutex->Attributes ) ) {
56    if ( _Scheduler_Is_priority_higher_than(
57         executing->current_priority,
58         the_mutex->holder->current_priority)) {
59      _Thread_Change_priority(
60        the_mutex->holder,
61        executing->current_priority,
62        false
63      );
64    }
65  }
66
67  the_mutex->blocked_count++;
68  _Thread_queue_Enqueue( &the_mutex->Wait_queue, executing, timeout );
69
70  _Thread_Enable_dispatch();
71}
72
Note: See TracBrowser for help on using the repository browser.