summaryrefslogtreecommitdiffstats
path: root/cpukit/posix/src/condsignalsupp.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2017-09-26 07:49:17 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2017-10-05 14:29:02 +0200
commit5222488573e3ba8c2eceffe29f878a73a3a81694 (patch)
tree4b4ca72268b8f40da493ca252780c197bd23a5ef /cpukit/posix/src/condsignalsupp.c
parentposix: Implement self-contained POSIX rwlocks (diff)
downloadrtems-5222488573e3ba8c2eceffe29f878a73a3a81694.tar.bz2
posix: Implement self-contained POSIX condvar
POSIX condition variables are now available in all configurations and no longer depend on --enable-posix. Update #2514. Update #3113.
Diffstat (limited to 'cpukit/posix/src/condsignalsupp.c')
-rw-r--r--cpukit/posix/src/condsignalsupp.c35
1 files changed, 18 insertions, 17 deletions
diff --git a/cpukit/posix/src/condsignalsupp.c b/cpukit/posix/src/condsignalsupp.c
index e42476e1c4..1d9d4fc1ad 100644
--- a/cpukit/posix/src/condsignalsupp.c
+++ b/cpukit/posix/src/condsignalsupp.c
@@ -32,29 +32,30 @@ int _POSIX_Condition_variables_Signal_support(
bool is_broadcast
)
{
- Thread_Control *the_thread;
+ POSIX_Condition_variables_Control *the_cond;
+ unsigned long flags;
+ const Thread_queue_Operations *operations;
+ Thread_queue_Heads *heads;
- do {
- POSIX_Condition_variables_Control *the_cond;
- Thread_queue_Context queue_context;
+ the_cond = _POSIX_Condition_variables_Get( cond );
+ POSIX_CONDITION_VARIABLES_VALIDATE_OBJECT( the_cond, flags );
+ operations = POSIX_CONDITION_VARIABLES_TQ_OPERATIONS;
- the_cond = _POSIX_Condition_variables_Get( cond, &queue_context );
+ do {
+ Thread_queue_Context queue_context;
- if ( the_cond == NULL ) {
- return EINVAL;
- }
+ _Thread_queue_Context_initialize( &queue_context );
+ _POSIX_Condition_variables_Acquire( the_cond, &queue_context );
- _POSIX_Condition_variables_Acquire_critical( the_cond, &queue_context );
+ heads = the_cond->Queue.Queue.heads;
- the_thread = _Thread_queue_First_locked(
- &the_cond->Wait_queue,
- POSIX_CONDITION_VARIABLES_TQ_OPERATIONS
- );
+ if ( heads != NULL ) {
+ Thread_Control *the_thread;
- if ( the_thread != NULL ) {
+ the_thread = ( *operations->first )( heads );
_Thread_queue_Extract_critical(
- &the_cond->Wait_queue.Queue,
- POSIX_CONDITION_VARIABLES_TQ_OPERATIONS,
+ &the_cond->Queue.Queue,
+ operations,
the_thread,
&queue_context
);
@@ -62,7 +63,7 @@ int _POSIX_Condition_variables_Signal_support(
the_cond->mutex = POSIX_CONDITION_VARIABLES_NO_MUTEX;
_POSIX_Condition_variables_Release( the_cond, &queue_context );
}
- } while ( is_broadcast && the_thread != NULL );
+ } while ( is_broadcast && heads != NULL );
return 0;
}