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

4.115
Last change on this file since a0e6c73 was a0e6c73, checked in by Mathew Kallada <matkallada@…>, on 12/14/12 at 01:51:15

posix: Doxygen enhancement task #4

http://www.google-melange.com/gci/task/view/google/gci2012/7955219

  • 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-2007.
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.com/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/object.h>
26#include <rtems/score/states.h>
27#include <rtems/score/watchdog.h>
28#include <rtems/posix/cond.h>
29#include <rtems/posix/time.h>
30#include <rtems/posix/mutex.h>
31
32/*
33 *  _POSIX_Condition_variables_Signal_support
34 *
35 *  A support routine which implements guts of the broadcast and single task
36 *  wake up version of the "signal" operation.
37 */
38
39int _POSIX_Condition_variables_Signal_support(
40  pthread_cond_t            *cond,
41  bool                       is_broadcast
42)
43{
44  register POSIX_Condition_variables_Control *the_cond;
45  Objects_Locations                           location;
46  Thread_Control                             *the_thread;
47
48  the_cond = _POSIX_Condition_variables_Get( cond, &location );
49  switch ( location ) {
50
51    case OBJECTS_LOCAL:
52      do {
53        the_thread = _Thread_queue_Dequeue( &the_cond->Wait_queue );
54        if ( !the_thread )
55          the_cond->Mutex = POSIX_CONDITION_VARIABLES_NO_MUTEX;
56      } while ( is_broadcast && the_thread );
57
58      _Thread_Enable_dispatch();
59
60      return 0;
61
62#if defined(RTEMS_MULTIPROCESSING)
63    case OBJECTS_REMOTE:
64#endif
65    case OBJECTS_ERROR:
66      break;
67  }
68
69  return EINVAL;
70}
Note: See TracBrowser for help on using the repository browser.