source: rtems/cpukit/score/src/coremutexseize.c @ 81f5957

4.104.114.95
Last change on this file since 81f5957 was 81f5957, checked in by Jennifer Averett <Jennifer.Averett@…>, on 01/25/08 at 20:14:45

2008-01-25 Jennifer Averett <jennifer.averett@…>

  • sapi/include/rtems/fatal.h, score/include/rtems/score/coremutex.h, score/include/rtems/score/interr.h, score/inline/rtems/score/thread.inl, score/src/coremutexseize.c: Modifications to aid in full path testing.
  • Property mode set to 100644
File size: 1.8 KB
Line 
1/*
2 *  Mutex Handler
3 *
4 *  DESCRIPTION:
5 *
6 *  This package is the implementation of the Mutex Handler.
7 *  This handler provides synchronization and mutual exclusion capabilities.
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.com/license/LICENSE.
15 *
16 *  $Id$
17 */
18
19#if HAVE_CONFIG_H
20#include "config.h"
21#endif
22
23#include <rtems/system.h>
24#include <rtems/score/isr.h>
25#include <rtems/score/coremutex.h>
26#include <rtems/score/states.h>
27#include <rtems/score/thread.h>
28#include <rtems/score/threadq.h>
29
30#if defined(__RTEMS_DO_NOT_INLINE_CORE_MUTEX_SEIZE__)
31void _CORE_mutex_Seize(
32  CORE_mutex_Control  *_the_mutex,
33  Objects_Id           _id,
34  boolean              _wait,
35  Watchdog_Interval    _timeout,
36  ISR_Level            _level
37)
38{
39  _CORE_mutex_Seize_body( _the_mutex, _id, _wait, _timeout, _level );
40}
41#endif
42
43/*PAGE
44 *
45 *  _CORE_mutex_Seize (interrupt blocking support)
46 *
47 *  This routine blocks the caller thread after an attempt attempts to obtain
48 *  the specified mutex has failed.
49 *
50 *  Input parameters:
51 *    the_mutex - pointer to mutex control block
52 *    timeout   - number of ticks to wait (0 means forever)
53 */
54
55void _CORE_mutex_Seize_interrupt_blocking(
56  CORE_mutex_Control  *the_mutex,
57  Watchdog_Interval    timeout
58)
59{
60  Thread_Control   *executing;
61
62  executing = _Thread_Executing;
63  if ( _CORE_mutex_Is_inherit_priority( &the_mutex->Attributes ) ) {
64    if ( the_mutex->holder->current_priority > executing->current_priority ) {
65      _Thread_Change_priority(
66        the_mutex->holder,
67        executing->current_priority,
68        FALSE
69      );
70    }
71  }
72
73  the_mutex->blocked_count++;
74  _Thread_queue_Enqueue( &the_mutex->Wait_queue, timeout );
75
76  _Thread_Enable_dispatch();
77}
78
Note: See TracBrowser for help on using the repository browser.