OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rtems-20020807/] [cpukit/] [posix/] [src/] [condsignalsupp.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1026 ivang
/*
2
 *  condsignalsupp.c,v 1.2 2001/01/24 14:17:28 joel Exp
3
 */
4
 
5
#if HAVE_CONFIG_H
6
#include "config.h"
7
#endif
8
 
9
#include <pthread.h>
10
#include <errno.h>
11
 
12
#include <rtems/system.h>
13
#include <rtems/score/object.h>
14
#include <rtems/score/states.h>
15
#include <rtems/score/watchdog.h>
16
#include <rtems/posix/cond.h>
17
#include <rtems/posix/time.h>
18
#include <rtems/posix/mutex.h>
19
 
20
/*PAGE
21
 *
22
 *  _POSIX_Condition_variables_Signal_support
23
 *
24
 *  A support routine which implements guts of the broadcast and single task
25
 *  wake up version of the "signal" operation.
26
 */
27
 
28
int _POSIX_Condition_variables_Signal_support(
29
  pthread_cond_t            *cond,
30
  boolean                    is_broadcast
31
)
32
{
33
  register POSIX_Condition_variables_Control *the_cond;
34
  Objects_Locations                           location;
35
  Thread_Control                             *the_thread;
36
 
37
  the_cond = _POSIX_Condition_variables_Get( cond, &location );
38
  switch ( location ) {
39
    case OBJECTS_REMOTE:
40
#if defined(RTEMS_MULTIPROCESSING)
41
      _Thread_Dispatch();
42
      return POSIX_MP_NOT_IMPLEMENTED();
43
      return EINVAL;
44
#endif
45
 
46
    case OBJECTS_ERROR:
47
      return EINVAL;
48
    case OBJECTS_LOCAL:
49
 
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
      _Thread_Enable_dispatch();
57
 
58
      return 0;
59
  }
60
  return POSIX_BOTTOM_REACHED();
61
}

powered by: WebSVN 2.1.0

© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.