source: rtems/cpukit/posix/include/rtems/posix/condimpl.h @ 1e1a91ed

5
Last change on this file since 1e1a91ed was 1e1a91ed, checked in by Sebastian Huber <sebastian.huber@…>, on 03/23/16 at 09:01:31

score: Remove Thread_queue_Queue::operations field

Remove the Thread_queue_Queue::operations field to reduce the size of
this structure. Add a thread queue operations parameter to the
_Thread_queue_First(), _Thread_queue_First_locked(),
_Thread_queue_Enqueue(), _Thread_queue_Dequeue() and
_Thread_queue_Flush() functions. This is a preparation patch to reduce
the size of several synchronization objects.

  • Property mode set to 100644
File size: 3.5 KB
Line 
1/**
2 * @file
3 *
4 * This include file contains the static inline implementation of the private
5 * inlined routines for POSIX condition variables.
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2013.
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.org/license/LICENSE.
15 */
16
17#ifndef _RTEMS_POSIX_CONDIMPL_H
18#define _RTEMS_POSIX_CONDIMPL_H
19 
20#include <rtems/posix/cond.h>
21#include <rtems/score/objectimpl.h>
22#include <rtems/score/threadqimpl.h>
23#include <rtems/score/watchdog.h>
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
29/**
30 *  Constant to indicate condition variable does not currently have
31 *  a mutex assigned to it.
32 */
33#define POSIX_CONDITION_VARIABLES_NO_MUTEX 0
34
35#define POSIX_CONDITION_VARIABLES_TQ_OPERATIONS &_Thread_queue_Operations_FIFO
36
37/**
38 *  The following defines the information control block used to manage
39 *  this class of objects.
40 */
41extern Objects_Information _POSIX_Condition_variables_Information;
42
43/**
44 *  The default condition variable attributes structure.
45 */
46extern const pthread_condattr_t _POSIX_Condition_variables_Default_attributes;
47
48/**
49 *  @brief POSIX Condition Variable Allocate
50 *
51 *  This function allocates a condition variable control block from
52 *  the inactive chain of free condition variable control blocks.
53 */
54RTEMS_INLINE_ROUTINE POSIX_Condition_variables_Control *
55  _POSIX_Condition_variables_Allocate( void )
56{
57  return (POSIX_Condition_variables_Control *)
58    _Objects_Allocate( &_POSIX_Condition_variables_Information );
59}
60
61/**
62 *  @brief POSIX Condition Variable Free
63 *
64 *  This routine frees a condition variable control block to the
65 *  inactive chain of free condition variable control blocks.
66 */
67RTEMS_INLINE_ROUTINE void _POSIX_Condition_variables_Free (
68  POSIX_Condition_variables_Control *the_condition_variable
69)
70{
71  _Thread_queue_Destroy( &the_condition_variable->Wait_queue );
72  _Objects_Free(
73    &_POSIX_Condition_variables_Information,
74    &the_condition_variable->Object
75  );
76}
77
78/**
79 *  @brief POSIX Condition Variable Get
80 *
81 *  This function maps condition variable IDs to condition variable control
82 *  blocks.  If ID corresponds to a local condition variable, then it returns
83 *  the_condition variable control pointer which maps to ID and location
84 *  is set to OBJECTS_LOCAL.  if the condition variable ID is global and
85 *  resides on a remote node, then location is set to OBJECTS_REMOTE,
86 *  and the_condition variable is undefined.  Otherwise, location is set
87 *  to OBJECTS_ERROR and the_condition variable is undefined.
88 */
89POSIX_Condition_variables_Control *_POSIX_Condition_variables_Get (
90  pthread_cond_t    *cond,
91  Objects_Locations *location
92);
93
94/**
95 * @brief Implements wake up version of the "signal" operation.
96 *
97 * A support routine which implements guts of the broadcast and single task
98 * wake up version of the "signal" operation.
99 */
100int _POSIX_Condition_variables_Signal_support(
101  pthread_cond_t            *cond,
102  bool                       is_broadcast
103);
104
105/**
106 * @brief POSIX condition variables wait support.
107 *
108 * A support routine which implements guts of the blocking, non-blocking, and
109 * timed wait version of condition variable wait routines.
110 */
111int _POSIX_Condition_variables_Wait_support(
112  pthread_cond_t            *cond,
113  pthread_mutex_t           *mutex,
114  Watchdog_Interval          timeout,
115  bool                       already_timedout
116);
117
118#ifdef __cplusplus
119}
120#endif
121
122#endif
123/*  end of include file */
Note: See TracBrowser for help on using the repository browser.