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

Last change on this file since bbd6d27a was bbd6d27a, checked in by Sebastian Huber <sebastian.huber@…>, on Apr 15, 2016 at 2:27:56 PM

score: Delete unused CORE_RWLock_Attributes

  • Property mode set to 100644
File size: 3.8 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/watchdog.h>
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
31/**
32 * @addtogroup ScoreRWLock
33 */
34/**@{**/
35
36#define CORE_RWLOCK_TQ_OPERATIONS &_Thread_queue_Operations_FIFO
37
38/**
39 *  Core RWLock handler return statuses.
40 */
41typedef enum {
42  /** This status indicates that the operation completed successfully. */
43  CORE_RWLOCK_SUCCESSFUL,
44  /** This status indicates that the thread was blocked waiting for an */
45  CORE_RWLOCK_WAS_DELETED,
46  /** This status indicates that the rwlock was not immediately available. */
47  CORE_RWLOCK_UNAVAILABLE,
48  /** This status indicates that the calling task was willing to block
49   *  but the operation was unable to complete within the time allotted
50   *  because the resource never became available.
51   */
52  CORE_RWLOCK_TIMEOUT
53}   CORE_RWLock_Status;
54
55/** This is the last status value.
56 */
57#define CORE_RWLOCK_STATUS_LAST CORE_RWLOCK_TIMEOUT
58
59/**
60 *  This is used to denote that a thread is blocking waiting for
61 *  read-only access to the RWLock.
62 */
63#define CORE_RWLOCK_THREAD_WAITING_FOR_READ  0
64
65/**
66 *  This is used to denote that a thread is blocking waiting for
67 *  write-exclusive access to the RWLock.
68 */
69#define CORE_RWLOCK_THREAD_WAITING_FOR_WRITE 1
70
71/**
72 *  @brief Initialize a RWlock.
73 *
74 *  This routine initializes the RWLock based on the parameters passed.
75 *
76 *  @param[in] the_rwlock is the RWLock to initialize
77 */
78void _CORE_RWLock_Initialize(
79  CORE_RWLock_Control *the_rwlock
80);
81
82RTEMS_INLINE_ROUTINE void _CORE_RWLock_Destroy(
83  CORE_RWLock_Control *the_rwlock
84)
85{
86  _Thread_queue_Destroy( &the_rwlock->Wait_queue );
87}
88
89/**
90 *  @brief Obtain RWLock for reading.
91 *
92 *  This routine attempts to obtain the RWLock for read access.
93 *
94 *  @param[in] the_rwlock is the RWLock to wait for
95 *  @param[in] wait is true if the calling thread is willing to wait
96 *  @param[in] timeout is the number of ticks the calling thread is willing
97 *         to wait if @a wait is true.
98 *
99 * @note Status is returned via the thread control block.
100 */
101
102void _CORE_RWLock_Obtain_for_reading(
103  CORE_RWLock_Control *the_rwlock,
104  Thread_Control      *executing,
105  bool                 wait,
106  Watchdog_Interval    timeout
107);
108
109/**
110 *  @brief Obtain RWLock for writing.
111 *
112 *  This routine attempts to obtain the RWLock for write exclusive access.
113 *
114 *  @param[in] the_rwlock is the RWLock to wait for
115 *  @param[in] wait is true if the calling thread is willing to wait
116 *  @param[in] timeout is the number of ticks the calling thread is willing
117 *         to wait if @a wait is true.
118 *
119 * @note Status is returned via the thread control block.
120 */
121void _CORE_RWLock_Obtain_for_writing(
122  CORE_RWLock_Control *the_rwlock,
123  Thread_Control      *executing,
124  bool                 wait,
125  Watchdog_Interval    timeout
126);
127
128/**
129 *  @brief Release the RWLock.
130 *
131 *  This routine manually releases @a the_rwlock.  All of the threads waiting
132 *  for the RWLock will be readied.
133 *
134 *  @param[in] the_rwlock is the RWLock to surrender
135 *
136 *  @retval Status is returned to indicate successful or failure.
137 */
138CORE_RWLock_Status _CORE_RWLock_Release(
139  CORE_RWLock_Control *the_rwlock,
140  Thread_Control      *executing
141);
142
143/** @} */
144
145#ifdef __cplusplus
146}
147#endif
148
149#endif
150/* end of include file */
Note: See TracBrowser for help on using the repository browser.