source: rtems/cpukit/score/src/coremutexseize.c @ 62181b21

4.115
Last change on this file since 62181b21 was 9b4422a2, checked in by Joel Sherrill <joel.sherrill@…>, on 05/03/12 at 15:09:24

Remove All CVS Id Strings Possible Using a Script

Script does what is expected and tries to do it as
smartly as possible.

+ remove occurrences of two blank comment lines

next to each other after Id string line removed.

+ remove entire comment blocks which only exited to

contain CVS Ids

+ If the processing left a blank line at the top of

a file, it was removed.

  • Property mode set to 100644
File size: 1.9 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
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/coremutex.h>
24#include <rtems/score/states.h>
25#include <rtems/score/thread.h>
26#include <rtems/score/threadq.h>
27
28#if defined(__RTEMS_DO_NOT_INLINE_CORE_MUTEX_SEIZE__)
29void _CORE_mutex_Seize(
30  CORE_mutex_Control  *_the_mutex,
31  Objects_Id           _id,
32  bool                 _wait,
33  Watchdog_Interval    _timeout,
34  ISR_Level            _level
35)
36{
37  _CORE_mutex_Seize_body( _the_mutex, _id, _wait, _timeout, _level );
38}
39#endif
40
41/*
42 *  _CORE_mutex_Seize (interrupt blocking support)
43 *
44 *  This routine blocks the caller thread after an attempt attempts to obtain
45 *  the specified mutex has failed.
46 *
47 *  Input parameters:
48 *    the_mutex - pointer to mutex control block
49 *    timeout   - number of ticks to wait (0 means forever)
50 */
51
52void _CORE_mutex_Seize_interrupt_blocking(
53  CORE_mutex_Control  *the_mutex,
54  Watchdog_Interval    timeout
55)
56{
57  Thread_Control   *executing;
58
59  executing = _Thread_Executing;
60  if ( _CORE_mutex_Is_inherit_priority( &the_mutex->Attributes ) ) {
61    if ( _Scheduler_Is_priority_higher_than(
62         executing->current_priority,
63         the_mutex->holder->current_priority)) {
64      _Thread_Change_priority(
65        the_mutex->holder,
66        executing->current_priority,
67        false
68      );
69    }
70  }
71
72  the_mutex->blocked_count++;
73  _Thread_queue_Enqueue( &the_mutex->Wait_queue, timeout );
74
75  _Thread_Enable_dispatch();
76}
77
Note: See TracBrowser for help on using the repository browser.