source: rtems/cpukit/posix/src/condget.c @ be1b8a7

4.115
Last change on this file since be1b8a7 was 35210b12, checked in by Sebastian Huber <sebastian.huber@…>, on 07/19/13 at 10:08:02

posix: Create condition variable impl header

Move implementation specific parts of cond.h and cond.inl into new
header file condimpl.h. The cond.h contains now only the application
visible API.

  • Property mode set to 100644
File size: 1.2 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-2007.
3 *  On-Line Applications Research Corporation (OAR).
4 *
5 *  The license and distribution terms for this file may be
6 *  found in the file LICENSE in this distribution or at
7 *  http://www.rtems.com/license/LICENSE.
8 */
9
10#if HAVE_CONFIG_H
11#include "config.h"
12#endif
13
14#include <pthread.h>
15#include <errno.h>
16
17#include <rtems/system.h>
18#include <rtems/score/object.h>
19#include <rtems/score/states.h>
20#include <rtems/score/watchdog.h>
21#include <rtems/posix/condimpl.h>
22#include <rtems/posix/time.h>
23#include <rtems/posix/muteximpl.h>
24
25POSIX_Condition_variables_Control *_POSIX_Condition_variables_Get (
26  pthread_cond_t    *cond,
27  Objects_Locations *location
28)
29{
30  int status;
31
32  if ( !cond ) {
33    *location = OBJECTS_ERROR;
34    return (POSIX_Condition_variables_Control *) 0;
35  }
36
37  if ( *cond == PTHREAD_COND_INITIALIZER ) {
38    /*
39     *  Do an "auto-create" here.
40     */
41
42    status = pthread_cond_init( cond, 0 );
43    if ( status ) {
44      *location = OBJECTS_ERROR;
45      return (POSIX_Condition_variables_Control *) 0;
46    }
47  }
48
49  /*
50   *  Now call Objects_Get()
51   */
52  return (POSIX_Condition_variables_Control *)_Objects_Get(
53    &_POSIX_Condition_variables_Information,
54    (Objects_Id) *cond,
55    location
56  );
57}
58
Note: See TracBrowser for help on using the repository browser.