source: rtems/cpukit/posix/src/condget.c @ 4d320062

4.104.114.95
Last change on this file since 4d320062 was 4d320062, checked in by Joel Sherrill <joel.sherrill@…>, on 01/09/08 at 22:08:31

2008-01-09 Joel Sherrill <joel.sherrill@…>

  • posix/Makefile.am, posix/include/rtems/posix/cond.h, posix/include/rtems/posix/mutex.h, posix/inline/rtems/posix/cond.inl, posix/inline/rtems/posix/mutex.inl: Do not include POSIX Mutex or Condition Variable object get helpers because they are more complicated than the norm. They can implicitly perform a create. They cross the line as being too complex and large to inline since they negatively impact size and binary test coverage.
  • posix/src/condget.c, posix/src/mutexget.c: New files.
  • Property mode set to 100644
File size: 1.3 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  Objects_Id        *id = (Objects_Id *)cond;
33  int status;
34
35  if ( !id ) {
36    *location = OBJECTS_ERROR;
37    return (POSIX_Condition_variables_Control *) 0;
38  }
39
40  if ( *id == PTHREAD_COND_INITIALIZER ) {
41    /*
42     *  Do an "auto-create" here.
43     */
44
45    status = pthread_cond_init( (pthread_cond_t *)id, 0 );
46    if ( status ) {
47      *location = OBJECTS_ERROR;
48      return (POSIX_Condition_variables_Control *) 0;
49    }
50  }
51
52  /*
53   *  Now call Objects_Get()
54   */
55
56  return (POSIX_Condition_variables_Control *)
57    _Objects_Get( &_POSIX_Condition_variables_Information, *id, location );
58}
59 
Note: See TracBrowser for help on using the repository browser.