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

Subversion Repositories openrisc

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
/*
2
 *  $Id: conddestroy.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
 *  11.4.2 Initializing and Destroying a Condition Variable,
19
 *         P1003.1c/Draft 10, p. 87
20
 */
21
 
22
int pthread_cond_destroy(
23
  pthread_cond_t           *cond
24
)
25
{
26
  register POSIX_Condition_variables_Control *the_cond;
27
  Objects_Locations                           location;
28
 
29
  the_cond = _POSIX_Condition_variables_Get( cond, &location );
30
  switch ( location ) {
31
    case OBJECTS_REMOTE:
32
#if defined(RTEMS_MULTIPROCESSING)
33
      _Thread_Dispatch();
34
      return POSIX_MP_NOT_IMPLEMENTED();
35
      return EINVAL;
36
#endif
37
 
38
    case OBJECTS_ERROR:
39
      return EINVAL;
40
 
41
 
42
    case OBJECTS_LOCAL:
43
 
44
      if ( _Thread_queue_First( &the_cond->Wait_queue ) ) {
45
        _Thread_Enable_dispatch();
46
        return EBUSY;
47
      }
48
 
49
      _Objects_Close(
50
        &_POSIX_Condition_variables_Information,
51
        &the_cond->Object
52
      );
53
 
54
      _POSIX_Condition_variables_Free( the_cond );
55
 
56
#if defined(RTEMS_MULTIPROCESSING)
57
      if ( the_cond->process_shared == PTHREAD_PROCESS_SHARED ) {
58
 
59
        _Objects_MP_Close(
60
          &_POSIX_Condition_variables_Information,
61
          the_cond->Object.id
62
        );
63
 
64
        _POSIX_Condition_variables_MP_Send_process_packet(
65
          POSIX_CONDITION_VARIABLES_MP_ANNOUNCE_DELETE,
66
          the_cond->Object.id,
67
          0,                         /* Not used */
68
 
69
        );
70
      }
71
#endif
72
      _Thread_Enable_dispatch();
73
      return 0;
74
  }
75
  return POSIX_BOTTOM_REACHED();
76
}

powered by: WebSVN 2.1.0

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