OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [exec/] [posix/] [inline/] [rtems/] [posix/] [mutex.inl] - Blame information for rev 173

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
/*  rtems/posix/mutex.inl
2
 *
3
 *  This include file contains the static inline implementation of the private
4
 *  inlined routines for POSIX mutex's.
5
 *
6
 *  COPYRIGHT (c) 1989-1999.
7
 *  On-Line Applications Research Corporation (OAR).
8
 *
9
 *  The license and distribution terms for this file may be
10
 *  found in the file LICENSE in this distribution or at
11
 *  http://www.OARcorp.com/rtems/license.html.
12
 *
13
 *  $Id: mutex.inl,v 1.2 2001-09-27 11:59:14 chris Exp $
14
 */
15
 
16
#ifndef __RTEMS_POSIX_MUTEX_inl
17
#define __RTEMS_POSIX_MUTEX_inl
18
 
19
/*PAGE
20
 *
21
 *  _POSIX_Mutex_Allocate
22
 */
23
 
24
RTEMS_INLINE_ROUTINE POSIX_Mutex_Control *_POSIX_Mutex_Allocate( void )
25
{
26
  return (POSIX_Mutex_Control *) _Objects_Allocate( &_POSIX_Mutex_Information );
27
}
28
 
29
/*PAGE
30
 *
31
 *  _POSIX_Mutex_Free
32
 */
33
 
34
RTEMS_INLINE_ROUTINE void _POSIX_Mutex_Free (
35
  POSIX_Mutex_Control *the_mutex
36
)
37
{
38
  _Objects_Free( &_POSIX_Mutex_Information, &the_mutex->Object );
39
}
40
 
41
/*PAGE
42
 *
43
 *  _POSIX_Mutex_Get
44
 */
45
 
46
RTEMS_INLINE_ROUTINE POSIX_Mutex_Control *_POSIX_Mutex_Get (
47
  Objects_Id        *id,
48
  Objects_Locations *location
49
)
50
{
51
  int status;
52
 
53
  if ( !id ) {
54
    *location = OBJECTS_ERROR;
55
    return (POSIX_Mutex_Control *) 0;
56
  }
57
 
58
  if ( *id == PTHREAD_MUTEX_INITIALIZER ) {
59
    /*
60
     *  Do an "auto-create" here.
61
     */
62
 
63
    status = pthread_mutex_init( id, 0 );
64
    if ( status ) {
65
      *location = OBJECTS_ERROR;
66
      return (POSIX_Mutex_Control *) 0;
67
    }
68
  }
69
 
70
  /*
71
   *  Now call Objects_Get()
72
   */
73
 
74
  return (POSIX_Mutex_Control *)
75
    _Objects_Get( &_POSIX_Mutex_Information, *id, location );
76
}
77
 
78
/*PAGE
79
 *
80
 *  _POSIX_Mutex_Is_null
81
 */
82
 
83
RTEMS_INLINE_ROUTINE boolean _POSIX_Mutex_Is_null (
84
  POSIX_Mutex_Control *the_mutex
85
)
86
{
87
  return !the_mutex;
88
}
89
 
90
#endif
91
/*  end of include file */
92
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.