source: rtems/cpukit/score/include/rtems/score/coresem.h @ dd687d97

4.104.114.84.95
Last change on this file since dd687d97 was dd687d97, checked in by Joel Sherrill <joel.sherrill@…>, on 09/04/03 at 18:56:05

2003-09-04 Joel Sherrill <joel@…>

  • include/rtems/debug.h, include/rtems/seterr.h, include/rtems/system.h, include/rtems/score/address.h, include/rtems/score/apiext.h, include/rtems/score/apimutex.h, include/rtems/score/bitfield.h, include/rtems/score/chain.h, include/rtems/score/context.h, include/rtems/score/copyrt.h, include/rtems/score/coremsg.h, include/rtems/score/coremutex.h, include/rtems/score/coresem.h, include/rtems/score/heap.h, include/rtems/score/interr.h, include/rtems/score/isr.h, include/rtems/score/mpci.h, include/rtems/score/mppkt.h, include/rtems/score/object.h, include/rtems/score/objectmp.h, include/rtems/score/priority.h, include/rtems/score/stack.h, include/rtems/score/states.h, include/rtems/score/sysstate.h, include/rtems/score/thread.h, include/rtems/score/threadmp.h, include/rtems/score/threadq.h, include/rtems/score/tod.h, include/rtems/score/tqdata.h, include/rtems/score/userext.h, include/rtems/score/watchdog.h, include/rtems/score/wkspace.h, inline/rtems/score/address.inl, inline/rtems/score/chain.inl, inline/rtems/score/coremsg.inl, inline/rtems/score/coremutex.inl, inline/rtems/score/coresem.inl, inline/rtems/score/heap.inl, inline/rtems/score/isr.inl, inline/rtems/score/mppkt.inl, inline/rtems/score/object.inl, inline/rtems/score/objectmp.inl, inline/rtems/score/priority.inl, inline/rtems/score/stack.inl, inline/rtems/score/states.inl, inline/rtems/score/sysstate.inl, inline/rtems/score/thread.inl, inline/rtems/score/threadmp.inl, inline/rtems/score/tod.inl, inline/rtems/score/tqdata.inl, inline/rtems/score/userext.inl, inline/rtems/score/watchdog.inl, inline/rtems/score/wkspace.inl, macros/rtems/score/address.inl, macros/rtems/score/chain.inl, macros/rtems/score/coremsg.inl, macros/rtems/score/coremutex.inl, macros/rtems/score/coresem.inl, macros/rtems/score/heap.inl, macros/rtems/score/isr.inl, macros/rtems/score/mppkt.inl, macros/rtems/score/object.inl, macros/rtems/score/objectmp.inl, macros/rtems/score/priority.inl, macros/rtems/score/stack.inl, macros/rtems/score/states.inl, macros/rtems/score/sysstate.inl, macros/rtems/score/thread.inl, macros/rtems/score/threadmp.inl, macros/rtems/score/tod.inl, macros/rtems/score/tqdata.inl, macros/rtems/score/userext.inl, macros/rtems/score/watchdog.inl, macros/rtems/score/wkspace.inl, src/apiext.c, src/chain.c, src/coremsg.c, src/coremsgbroadcast.c, src/coremsgclose.c, src/coremsgflush.c, src/coremsgflushsupp.c, src/coremsgflushwait.c, src/coremsginsert.c, src/coremsgseize.c, src/coremsgsubmit.c, src/coremutex.c, src/coremutexflush.c, src/coremutexseize.c, src/coremutexsurrender.c, src/coresem.c, src/coresemflush.c, src/coresemseize.c, src/coresemsurrender.c, src/coretod.c, src/coretodset.c, src/coretodtickle.c, src/coretodtoseconds.c, src/coretodvalidate.c, src/heap.c, src/heapallocate.c, src/heapextend.c, src/heapfree.c, src/heapgetinfo.c, src/heapsizeofuserarea.c, src/heapwalk.c, src/interr.c, src/isr.c, src/iterateoverthreads.c, src/mpci.c, src/object.c, src/objectallocate.c, src/objectallocatebyindex.c, src/objectclearname.c, src/objectcomparenameraw.c, src/objectcomparenamestring.c, src/objectcopynameraw.c, src/objectcopynamestring.c, src/objectextendinformation.c, src/objectfree.c, src/objectget.c, src/objectgetbyindex.c, src/objectgetisr.c, src/objectgetnext.c, src/objectgetnoprotection.c, src/objectidtoname.c, src/objectinitializeinformation.c, src/objectmp.c, src/objectnametoid.c, src/objectshrinkinformation.c, src/thread.c, src/threadchangepriority.c, src/threadclearstate.c, src/threadclose.c, src/threadcreateidle.c, src/threaddelayended.c, src/threaddispatch.c, src/threadevaluatemode.c, src/threadget.c, src/threadhandler.c, src/threadidlebody.c, src/threadinitialize.c, src/threadloadenv.c, src/threadmp.c, src/threadq.c, src/threadqdequeue.c, src/threadqdequeuefifo.c, src/threadqdequeuepriority.c, src/threadqenqueue.c, src/threadqenqueuefifo.c, src/threadqenqueuepriority.c, src/threadqextract.c, src/threadqextractfifo.c, src/threadqextractpriority.c, src/threadqextractwithproxy.c, src/threadqfirst.c, src/threadqfirstfifo.c, src/threadqfirstpriority.c, src/threadqflush.c, src/threadqtimeout.c, src/threadready.c, src/threadreset.c, src/threadresettimeslice.c, src/threadrestart.c, src/threadresume.c, src/threadrotatequeue.c, src/threadsetpriority.c, src/threadsetstate.c, src/threadsettransient.c, src/threadstackallocate.c, src/threadstackfree.c, src/threadstart.c, src/threadstartmultitasking.c, src/threadsuspend.c, src/threadtickletimeslice.c, src/threadyieldprocessor.c, src/userext.c, src/watchdog.c, src/watchdogadjust.c, src/watchdoginsert.c, src/watchdogremove.c, src/watchdogtickle.c, src/wkspace.c: URL for license changed.
  • Property mode set to 100644
File size: 3.7 KB
Line 
1/*  core_sem.h
2 *
3 *  This include file contains all the constants and structures associated
4 *  with the Counting Semaphore Handler.  A counting semaphore is the
5 *  standard Dijkstra binary semaphore used to provide synchronization
6 *  and mutual exclusion capabilities.
7 *
8 *  COPYRIGHT (c) 1989-1999.
9 *  On-Line Applications Research Corporation (OAR).
10 *
11 *  The license and distribution terms for this file may be
12 *  found in the file LICENSE in this distribution or at
13 *  http://www.rtems.com/license/LICENSE.
14 *
15 *  $Id$
16 */
17 
18#ifndef __RTEMS_CORE_COUNTING_SEMAPHORE_h
19#define __RTEMS_CORE_COUNTING_SEMAPHORE_h
20 
21#ifdef __cplusplus
22extern "C" {
23#endif
24
25#include <rtems/score/thread.h>
26#include <rtems/score/threadq.h>
27#include <rtems/score/priority.h>
28#include <rtems/score/watchdog.h>
29 
30/*
31 *  The following type defines the callout which the API provides
32 *  to support global/multiprocessor operations on semaphores.
33 */
34 
35typedef void ( *CORE_semaphore_API_mp_support_callout )(
36                 Thread_Control *,
37                 Objects_Id
38             );
39
40/*
41 *  Blocking disciplines for a semaphore.
42 */
43
44typedef enum {
45  CORE_SEMAPHORE_DISCIPLINES_FIFO,
46  CORE_SEMAPHORE_DISCIPLINES_PRIORITY
47}   CORE_semaphore_Disciplines;
48
49/*
50 *  Core Semaphore handler return statuses.
51 */
52 
53typedef enum {
54  CORE_SEMAPHORE_STATUS_SUCCESSFUL,
55  CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT,
56  CORE_SEMAPHORE_WAS_DELETED,
57  CORE_SEMAPHORE_TIMEOUT,
58  CORE_SEMAPHORE_MAXIMUM_COUNT_EXCEEDED
59}   CORE_semaphore_Status;
60
61/*
62 *  The following defines the control block used to manage the
63 *  attributes of each semaphore.
64 */
65
66typedef struct {
67  unsigned32                  maximum_count;
68  CORE_semaphore_Disciplines  discipline;
69}   CORE_semaphore_Attributes;
70 
71/*
72 *  The following defines the control block used to manage each
73 *  counting semaphore.
74 */
75 
76typedef struct {
77  Thread_queue_Control        Wait_queue;
78  CORE_semaphore_Attributes   Attributes;
79  unsigned32                  count;
80}   CORE_semaphore_Control;
81
82/*
83 *  _CORE_semaphore_Initialize
84 *
85 *  DESCRIPTION:
86 *
87 *  This routine initializes the semaphore based on the parameters passed.
88 */
89
90void _CORE_semaphore_Initialize(
91  CORE_semaphore_Control       *the_semaphore,
92  CORE_semaphore_Attributes    *the_semaphore_attributes,
93  unsigned32                    initial_value
94);
95 
96/*
97 *  _CORE_semaphore_Seize
98 *
99 *  DESCRIPTION:
100 *
101 *  This routine attempts to receive a unit from the_semaphore.
102 *  If a unit is available or if the wait flag is FALSE, then the routine
103 *  returns.  Otherwise, the calling task is blocked until a unit becomes
104 *  available.
105 */
106
107void _CORE_semaphore_Seize(
108  CORE_semaphore_Control  *the_semaphore,
109  Objects_Id               id,
110  boolean                  wait,
111  Watchdog_Interval        timeout
112);
113 
114/*
115 *  _CORE_semaphore_Surrender
116 *
117 *  DESCRIPTION:
118 *
119 *  This routine frees a unit to the semaphore.  If a task was blocked waiting
120 *  for a unit from this semaphore, then that task will be readied and the unit
121 *  given to that task.  Otherwise, the unit will be returned to the semaphore.
122 */
123
124CORE_semaphore_Status _CORE_semaphore_Surrender(
125  CORE_semaphore_Control                *the_semaphore,
126  Objects_Id                             id,
127  CORE_semaphore_API_mp_support_callout  api_semaphore_mp_support
128);
129 
130/*
131 *  _CORE_semaphore_Flush
132 *
133 *  DESCRIPTION:
134 *
135 *  This routine assists in the deletion of a semaphore by flushing the
136 *  associated wait queue.
137 */
138
139void _CORE_semaphore_Flush(
140  CORE_semaphore_Control         *the_semaphore,
141  Thread_queue_Flush_callout      remote_extract_callout,
142  unsigned32                      status
143);
144
145#ifndef __RTEMS_APPLICATION__
146#include <rtems/score/coresem.inl>
147#endif
148
149#ifdef __cplusplus
150}
151#endif
152 
153#endif
154/*  end of include file */
155
Note: See TracBrowser for help on using the repository browser.