source: rtems/cpukit/posix/src/condsignalsupp.c @ c499856

4.115
Last change on this file since c499856 was c499856, checked in by Chris Johns <chrisj@…>, on 03/20/14 at 21:10:47

Change all references of rtems.com to rtems.org.

  • Property mode set to 100644
File size: 1.6 KB
Line 
1/**
2 * @file
3 *
4 * @brief Implements wake up version of the "signal" operation
5 * @ingroup POSIX_COND_VARS Condition Variables
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2014.
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#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <pthread.h>
22#include <errno.h>
23
24#include <rtems/system.h>
25#include <rtems/score/watchdog.h>
26#include <rtems/posix/condimpl.h>
27#include <rtems/posix/time.h>
28#include <rtems/posix/muteximpl.h>
29
30/*
31 *  _POSIX_Condition_variables_Signal_support
32 *
33 *  A support routine which implements guts of the broadcast and single task
34 *  wake up version of the "signal" operation.
35 */
36
37int _POSIX_Condition_variables_Signal_support(
38  pthread_cond_t            *cond,
39  bool                       is_broadcast
40)
41{
42  POSIX_Condition_variables_Control          *the_cond;
43  Objects_Locations                           location;
44  Thread_Control                             *the_thread;
45
46  the_cond = _POSIX_Condition_variables_Get( cond, &location );
47  switch ( location ) {
48
49    case OBJECTS_LOCAL:
50      do {
51        the_thread = _Thread_queue_Dequeue( &the_cond->Wait_queue );
52        if ( !the_thread )
53          the_cond->Mutex = POSIX_CONDITION_VARIABLES_NO_MUTEX;
54      } while ( is_broadcast && the_thread );
55
56      _Objects_Put( &the_cond->Object );
57
58      return 0;
59
60#if defined(RTEMS_MULTIPROCESSING)
61    case OBJECTS_REMOTE:
62#endif
63    case OBJECTS_ERROR:
64      break;
65  }
66
67  return EINVAL;
68}
Note: See TracBrowser for help on using the repository browser.