source: rtems/cpukit/posix/src/conddestroy.c @ 5cb175bb

4.115
Last change on this file since 5cb175bb was 5cb175bb, checked in by Joel Sherrill <joel.sherrill@…>, on 01/10/13 at 19:22:31

cpukit/posix: Doxygen group is POSIXAPI

  • Property mode set to 100644
File size: 1.4 KB
Line 
1/**
2 *  @file
3 *
4 *  @brief Destroy a Condition Variable
5 *  @ingroup POSIXAPI
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 *  11.4.2 Initializing and Destroying a Condition Variable,
34 *         P1003.1c/Draft 10, p. 87
35 */
36int pthread_cond_destroy(
37  pthread_cond_t           *cond
38)
39{
40  POSIX_Condition_variables_Control *the_cond;
41  Objects_Locations                  location;
42
43  the_cond = _POSIX_Condition_variables_Get( cond, &location );
44  switch ( location ) {
45
46    case OBJECTS_LOCAL:
47
48      if ( _Thread_queue_First( &the_cond->Wait_queue ) ) {
49        _Thread_Enable_dispatch();
50        return EBUSY;
51      }
52
53      _Objects_Close(
54        &_POSIX_Condition_variables_Information,
55        &the_cond->Object
56      );
57
58      _POSIX_Condition_variables_Free( the_cond );
59      _Thread_Enable_dispatch();
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.