source: rtems/c/src/exec/posix/src/conddestroy.c @ db7f70a

4.104.114.84.95
Last change on this file since db7f70a was 43ed935, checked in by Joel Sherrill <joel.sherrill@…>, on 11/02/99 at 18:46:30

Missed these in the initial split up.

  • Property mode set to 100644
File size: 1.7 KB
Line 
1/*
2 *  $Id$
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 
22int 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          0                          /* Not used */
69        );
70      }
71#endif
72      _Thread_Enable_dispatch();
73      return 0;
74  }
75  return POSIX_BOTTOM_REACHED();
76}
Note: See TracBrowser for help on using the repository browser.