36#ifndef _RTEMS_POSIX_CONDIMPL_H
37#define _RTEMS_POSIX_CONDIMPL_H
52 pthread_mutex_t *
mutex;
55#define POSIX_CONDITION_VARIABLES_CLOCK_MONOTONIC 0x1UL
57#define POSIX_CONDITION_VARIABLES_FLAGS_MASK 0x1UL
59#define POSIX_CONDITION_VARIABLES_MAGIC 0x18dfb1feUL
65#define POSIX_CONDITION_VARIABLES_NO_MUTEX NULL
67#define POSIX_CONDITION_VARIABLES_TQ_OPERATIONS &_Thread_queue_Operations_FIFO
69#define POSIX_CONDITION_VARIABLE_OF_THREAD_QUEUE_QUEUE( queue ) \
71 queue, POSIX_Condition_variables_Control, Queue.Queue )
85static inline void _POSIX_Condition_variables_Initialize(
87 const pthread_condattr_t *the_attr
92 _Thread_queue_Queue_initialize( &the_cond->Queue.Queue, NULL );
95 flags = (uintptr_t) the_cond ^ POSIX_CONDITION_VARIABLES_MAGIC;
96 flags &= ~POSIX_CONDITION_VARIABLES_FLAGS_MASK;
98 if ( the_attr->clock == CLOCK_MONOTONIC ) {
99 flags |= POSIX_CONDITION_VARIABLES_CLOCK_MONOTONIC;
102 the_cond->flags = flags;
105static inline void _POSIX_Condition_variables_Destroy(
109 the_cond->flags = ~the_cond->flags;
112static inline clockid_t _POSIX_Condition_variables_Get_clock(
116 if ( ( flags & POSIX_CONDITION_VARIABLES_CLOCK_MONOTONIC ) != 0 ) {
117 return CLOCK_MONOTONIC;
120 return CLOCK_REALTIME;
131 _Thread_queue_Context_ISR_disable( queue_context, level );
132 _Thread_queue_Context_set_ISR_level( queue_context, level );
133 executing = _Thread_Executing;
134 _Thread_queue_Queue_acquire_critical(
135 &the_cond->Queue.Queue,
136 &executing->Potpourri_stats,
143static inline void _POSIX_Condition_variables_Release(
148 _Thread_queue_Queue_release(
149 &the_cond->Queue.Queue,
161 pthread_cond_t *cond,
172 pthread_cond_t *cond,
173 pthread_mutex_t *
mutex,
174 const struct timespec *abstime
177bool _POSIX_Condition_variables_Auto_initialization(
181#define POSIX_CONDITION_VARIABLES_VALIDATE_OBJECT( the_cond, flags ) \
183 if ( ( the_cond ) == NULL ) { \
186 flags = ( the_cond )->flags; \
188 ( ( (uintptr_t) ( the_cond ) ^ POSIX_CONDITION_VARIABLES_MAGIC ) \
189 & ~POSIX_CONDITION_VARIABLES_FLAGS_MASK ) \
190 != ( flags & ~POSIX_CONDITION_VARIABLES_FLAGS_MASK ) \
192 if ( !_POSIX_Condition_variables_Auto_initialization( the_cond ) ) { \
int _POSIX_Condition_variables_Wait_support(pthread_cond_t *cond, pthread_mutex_t *mutex, const struct timespec *abstime)
POSIX condition variables wait support.
Definition: condwaitsupp.c:113
#define POSIX_CONDITION_VARIABLES_NO_MUTEX
Definition: condimpl.h:65
const pthread_condattr_t _POSIX_Condition_variables_Default_attributes
Definition: conddefaultattributes.c:48
int _POSIX_Condition_variables_Signal_support(pthread_cond_t *cond, bool is_broadcast)
Implements wake up version of the "signal" operation.
Definition: condsignalsupp.c:50
uint32_t ISR_Level
Definition: isrlevel.h:60
POSIX Threads Private Support.
This header file provides the interfaces of the Per-CPU Information.
Definition: condimpl.h:49
Thread queue context for the thread queue methods.
Definition: threadq.h:216
Thread_queue_Lock_context Lock_context
The lock context for the thread queue acquire and release operations.
Definition: threadq.h:221
ISR_lock_Context Lock_context
The lock context for the thread queue acquire and release operations.
Definition: threadq.h:148
Thread queue with a layout compatible to struct _Thread_queue_Queue defined in Newlib <sys/lock....
Definition: threadqimpl.h:71
This header file provides interfaces of the Thread Queue Handler which are only used by the implement...