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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [exec/] [posix/] [src/] [condsignalsupp.c] - Blame information for rev 609

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
/*
2
 *  $Id: condsignalsupp.c,v 1.2 2001-09-27 11:59:17 chris Exp $
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
 
24
int _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
}

powered by: WebSVN 2.1.0

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