source: rtems/cpukit/posix/src/condget.c @ 3bacb250

4.104.115
Last change on this file since 3bacb250 was 1de949a8, checked in by Ralf Corsepius <ralf.corsepius@…>, on 11/30/09 at 15:49:52

Whitespace removal.

  • 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 *  $Id$
10 */
11
12#if HAVE_CONFIG_H
13#include "config.h"
14#endif
15
16#include <pthread.h>
17#include <errno.h>
18
19#include <rtems/system.h>
20#include <rtems/score/object.h>
21#include <rtems/score/states.h>
22#include <rtems/score/watchdog.h>
23#include <rtems/posix/cond.h>
24#include <rtems/posix/time.h>
25#include <rtems/posix/mutex.h>
26
27POSIX_Condition_variables_Control *_POSIX_Condition_variables_Get (
28  pthread_cond_t    *cond,
29  Objects_Locations *location
30)
31{
32  int status;
33
34  if ( !cond ) {
35    *location = OBJECTS_ERROR;
36    return (POSIX_Condition_variables_Control *) 0;
37  }
38
39  if ( *cond == PTHREAD_COND_INITIALIZER ) {
40    /*
41     *  Do an "auto-create" here.
42     */
43
44    status = pthread_cond_init( cond, 0 );
45    if ( status ) {
46      *location = OBJECTS_ERROR;
47      return (POSIX_Condition_variables_Control *) 0;
48    }
49  }
50
51  /*
52   *  Now call Objects_Get()
53   */
54  return (POSIX_Condition_variables_Control *)_Objects_Get(
55    &_POSIX_Condition_variables_Information,
56    (Objects_Id) *cond,
57    location
58  );
59}
60
Note: See TracBrowser for help on using the repository browser.