source: rtems/c/src/exec/posix/src/condsignalsupp.c @ 98dca75

4.104.114.84.95
Last change on this file since 98dca75 was 98dca75, checked in by Joel Sherrill <joel.sherrill@…>, on 11/02/99 at 18:25:26

Split condition variables into multiple files.

  • Property mode set to 100644
File size: 1.4 KB
Line 
1/*
2 *  $Id$
3 */
4
5#include <pthread.h>
6#include <errno.h>
7
8#include <rtems/system.h>
9#include <rtems/score/object.h>
10#include <rtems/score/states.h>
11#include <rtems/score/watchdog.h>
12#include <rtems/posix/cond.h>
13#include <rtems/posix/time.h>
14#include <rtems/posix/mutex.h>
15
16/*PAGE
17 *
18 *  _POSIX_Condition_variables_Signal_support
19 *
20 *  A support routine which implements guts of the broadcast and single task
21 *  wake up version of the "signal" operation.
22 */
23 
24int _POSIX_Condition_variables_Signal_support(
25  pthread_cond_t            *cond,
26  boolean                    is_broadcast
27)
28{
29  register POSIX_Condition_variables_Control *the_cond;
30  Objects_Locations                           location;
31  Thread_Control                             *the_thread;
32 
33  the_cond = _POSIX_Condition_variables_Get( cond, &location );
34  switch ( location ) {
35    case OBJECTS_REMOTE:
36#if defined(RTEMS_MULTIPROCESSING)
37      _Thread_Dispatch();
38      return POSIX_MP_NOT_IMPLEMENTED();
39      return EINVAL;
40#endif
41
42    case OBJECTS_ERROR:
43      return EINVAL;
44    case OBJECTS_LOCAL:
45 
46      do {
47        the_thread = _Thread_queue_Dequeue( &the_cond->Wait_queue );
48        if ( !the_thread )
49          the_cond->Mutex = POSIX_CONDITION_VARIABLES_NO_MUTEX;
50      } while ( is_broadcast && the_thread );
51
52      _Thread_Enable_dispatch();
53
54      return 0;
55  }
56  return POSIX_BOTTOM_REACHED();
57}
Note: See TracBrowser for help on using the repository browser.