source: rtems/cpukit/score/include/rtems/score/corerwlockimpl.h @ f23d470

5
Last change on this file since f23d470 was f23d470, checked in by Gedare Bloom <gedare@…>, on 06/09/16 at 15:33:15

cpukit: Add and use Watchdog_Discipline.

Clock disciplines may be WATCHDOG_RELATIVE, WATCHDOG_ABSOLUTE,
or WATCHDOG_NO_TIMEOUT. A discipline of WATCHDOG_RELATIVE with
a timeout of WATCHDOG_NO_TIMEOUT is equivalent to a discipline
of WATCHDOG_NO_TIMEOUT.

updates #2732

  • Property mode set to 100644
File size: 3.3 KB
Line 
1/**
2 * @file
3 *
4 * @brief Inlined Routines Associated with the SuperCore RWLock
5 *
6 * This include file contains all of the inlined routines associated
7 * with the SuperCore RWLock.
8 */
9
10/*
11 *  COPYRIGHT (c) 1989-2008.
12 *  On-Line Applications Research Corporation (OAR).
13 *
14 *  The license and distribution terms for this file may be
15 *  found in the file LICENSE in this distribution or at
16 *  http://www.rtems.org/license/LICENSE.
17 */
18
19#ifndef _RTEMS_SCORE_CORERWLOCKIMPL_H
20#define _RTEMS_SCORE_CORERWLOCKIMPL_H
21
22#include <rtems/score/corerwlock.h>
23#include <rtems/score/thread.h>
24#include <rtems/score/threadqimpl.h>
25#include <rtems/score/status.h>
26#include <rtems/score/watchdog.h>
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
32/**
33 * @addtogroup ScoreRWLock
34 */
35/**@{**/
36
37#define CORE_RWLOCK_TQ_OPERATIONS &_Thread_queue_Operations_FIFO
38
39/**
40 *  This is used to denote that a thread is blocking waiting for
41 *  read-only access to the RWLock.
42 */
43#define CORE_RWLOCK_THREAD_WAITING_FOR_READ  0
44
45/**
46 *  This is used to denote that a thread is blocking waiting for
47 *  write-exclusive access to the RWLock.
48 */
49#define CORE_RWLOCK_THREAD_WAITING_FOR_WRITE 1
50
51/**
52 *  @brief Initialize a RWlock.
53 *
54 *  This routine initializes the RWLock based on the parameters passed.
55 *
56 *  @param[in] the_rwlock is the RWLock to initialize
57 */
58void _CORE_RWLock_Initialize(
59  CORE_RWLock_Control *the_rwlock
60);
61
62RTEMS_INLINE_ROUTINE void _CORE_RWLock_Destroy(
63  CORE_RWLock_Control *the_rwlock
64)
65{
66  _Thread_queue_Destroy( &the_rwlock->Wait_queue );
67}
68
69RTEMS_INLINE_ROUTINE void _CORE_RWLock_Acquire_critical(
70  CORE_RWLock_Control  *the_rwlock,
71  Thread_queue_Context *queue_context
72)
73{
74  _Thread_queue_Acquire_critical(
75    &the_rwlock->Wait_queue,
76    &queue_context->Lock_context
77  );
78}
79
80RTEMS_INLINE_ROUTINE void _CORE_RWLock_Release(
81  CORE_RWLock_Control  *the_rwlock,
82  Thread_queue_Context *queue_context
83)
84{
85  _Thread_queue_Release(
86    &the_rwlock->Wait_queue,
87    &queue_context->Lock_context
88  );
89}
90
91/**
92 *  @brief Obtain RWLock for reading.
93 *
94 *  This routine attempts to obtain the RWLock for read access.
95 *
96 *  @param[in] the_rwlock is the RWLock to wait for
97 *  @param[in] wait is true if the calling thread is willing to wait
98 */
99
100Status_Control _CORE_RWLock_Seize_for_reading(
101  CORE_RWLock_Control  *the_rwlock,
102  Thread_Control       *executing,
103  bool                  wait,
104  Thread_queue_Context *queue_context
105);
106
107/**
108 *  @brief Obtain RWLock for writing.
109 *
110 *  This routine attempts to obtain the RWLock for write exclusive access.
111 *
112 *  @param[in] the_rwlock is the RWLock to wait for
113 *  @param[in] wait is true if the calling thread is willing to wait
114 */
115Status_Control _CORE_RWLock_Seize_for_writing(
116  CORE_RWLock_Control  *the_rwlock,
117  Thread_Control       *executing,
118  bool                  wait,
119  Thread_queue_Context *queue_context
120);
121
122/**
123 *  @brief Release the RWLock.
124 *
125 *  This routine manually releases @a the_rwlock.  All of the threads waiting
126 *  for the RWLock will be readied.
127 *
128 *  @param[in] the_rwlock is the RWLock to surrender
129 *
130 *  @retval Status is returned to indicate successful or failure.
131 */
132Status_Control _CORE_RWLock_Surrender(
133  CORE_RWLock_Control  *the_rwlock,
134  Thread_queue_Context *queue_context
135);
136
137/** @} */
138
139#ifdef __cplusplus
140}
141#endif
142
143#endif
144/* end of include file */
Note: See TracBrowser for help on using the repository browser.