1 | /* |
---|
2 | * COPYRIGHT (c) 1989-2007. |
---|
3 | * On-Line Applications Research Corporation (OAR). |
---|
4 | * |
---|
5 | * The license and distribution terms for this file may be |
---|
6 | * found in the file LICENSE in this distribution or at |
---|
7 | * http://www.rtems.com/license/LICENSE. |
---|
8 | * |
---|
9 | * $Id$ |
---|
10 | */ |
---|
11 | |
---|
12 | #if HAVE_CONFIG_H |
---|
13 | #include "config.h" |
---|
14 | #endif |
---|
15 | |
---|
16 | #include <pthread.h> |
---|
17 | #include <errno.h> |
---|
18 | |
---|
19 | #include <rtems/system.h> |
---|
20 | #include <rtems/score/object.h> |
---|
21 | #include <rtems/score/states.h> |
---|
22 | #include <rtems/score/watchdog.h> |
---|
23 | #include <rtems/posix/cond.h> |
---|
24 | #include <rtems/posix/time.h> |
---|
25 | #include <rtems/posix/mutex.h> |
---|
26 | |
---|
27 | /*PAGE |
---|
28 | * |
---|
29 | * _POSIX_Condition_variables_Signal_support |
---|
30 | * |
---|
31 | * A support routine which implements guts of the broadcast and single task |
---|
32 | * wake up version of the "signal" operation. |
---|
33 | */ |
---|
34 | |
---|
35 | int _POSIX_Condition_variables_Signal_support( |
---|
36 | pthread_cond_t *cond, |
---|
37 | bool is_broadcast |
---|
38 | ) |
---|
39 | { |
---|
40 | register POSIX_Condition_variables_Control *the_cond; |
---|
41 | Objects_Locations location; |
---|
42 | Thread_Control *the_thread; |
---|
43 | |
---|
44 | the_cond = _POSIX_Condition_variables_Get( cond, &location ); |
---|
45 | switch ( location ) { |
---|
46 | |
---|
47 | case OBJECTS_LOCAL: |
---|
48 | do { |
---|
49 | the_thread = _Thread_queue_Dequeue( &the_cond->Wait_queue ); |
---|
50 | if ( !the_thread ) |
---|
51 | the_cond->Mutex = POSIX_CONDITION_VARIABLES_NO_MUTEX; |
---|
52 | } while ( is_broadcast && the_thread ); |
---|
53 | |
---|
54 | _Thread_Enable_dispatch(); |
---|
55 | |
---|
56 | return 0; |
---|
57 | |
---|
58 | #if defined(RTEMS_MULTIPROCESSING) |
---|
59 | case OBJECTS_REMOTE: |
---|
60 | #endif |
---|
61 | case OBJECTS_ERROR: |
---|
62 | break; |
---|
63 | } |
---|
64 | |
---|
65 | return EINVAL; |
---|
66 | } |
---|