source: rtems/cpukit/score/src/coremutexseize.c @ 25f5730f

4.11
Last change on this file since 25f5730f was 24934e36, checked in by Sebastian Huber <sebastian.huber@…>, on Apr 3, 2014 at 1:03:35 PM

score: Add scheduler control to scheduler ops

Scheduler operations must be free of a global scheduler context to
enable partitioned/clustered scheduling.

  • Property mode set to 100644
File size: 1.4 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    Thread_Control *holder = the_mutex->holder;
57
58    _Scheduler_Change_priority_if_higher(
59      _Scheduler_Get( holder ),
60      holder,
61      executing->current_priority,
62      false
63    );
64  }
65
66  _Thread_queue_Enqueue( &the_mutex->Wait_queue, executing, timeout );
67
68  _Thread_Enable_dispatch();
69}
70
Note: See TracBrowser for help on using the repository browser.