source: rtems/cpukit/posix/macros/rtems/posix/mutex.inl @ 3394273

4.104.114.84.95
Last change on this file since 3394273 was 8e36f29, checked in by Joel Sherrill <joel.sherrill@…>, on 09/04/03 at 18:54:26

2003-09-04 Joel Sherrill <joel@…>

  • include/rtems/posix/cond.h, include/rtems/posix/condmp.h, include/rtems/posix/config.h, include/rtems/posix/intr.h, include/rtems/posix/key.h, include/rtems/posix/mqueue.h, include/rtems/posix/mqueuemp.h, include/rtems/posix/mutex.h, include/rtems/posix/mutexmp.h, include/rtems/posix/posixapi.h, include/rtems/posix/pthread.h, include/rtems/posix/pthreadmp.h, include/rtems/posix/ptimer.h, include/rtems/posix/semaphore.h, include/rtems/posix/semaphoremp.h, inline/rtems/posix/cond.inl, inline/rtems/posix/intr.inl, inline/rtems/posix/key.inl, inline/rtems/posix/mqueue.inl, inline/rtems/posix/mutex.inl, inline/rtems/posix/pthread.inl, inline/rtems/posix/semaphore.inl, inline/rtems/posix/timer.inl, macros/rtems/posix/cond.inl, macros/rtems/posix/intr.inl, macros/rtems/posix/key.inl, macros/rtems/posix/mqueue.inl, macros/rtems/posix/mutex.inl, macros/rtems/posix/pthread.inl, macros/rtems/posix/semaphore.inl, macros/rtems/posix/timer.inl, src/alarm.c, src/kill.c, src/killinfo.c, src/mqueuetranslatereturncode.c, src/pause.c, src/pthreadattrdestroy.c, src/pthreadattrgetdetachstate.c, src/pthreadattrgetinheritsched.c, src/pthreadattrgetschedparam.c, src/pthreadattrgetschedpolicy.c, src/pthreadattrgetscope.c, src/pthreadattrgetstackaddr.c, src/pthreadattrgetstacksize.c, src/pthreadattrinit.c, src/pthreadattrsetdetachstate.c, src/pthreadattrsetinheritsched.c, src/pthreadattrsetschedparam.c, src/pthreadattrsetschedpolicy.c, src/pthreadattrsetscope.c, src/pthreadattrsetstackaddr.c, src/pthreadattrsetstacksize.c, src/pthreadcreate.c, src/pthreaddetach.c, src/pthreadequal.c, src/pthreadexit.c, src/pthreadgetcpuclockid.c, src/pthreadgetcputime.c, src/pthreadgetschedparam.c, src/pthreadjoin.c, src/pthreadkill.c, src/pthreadonce.c, src/pthreadself.c, src/pthreadsetcputime.c, src/pthreadsetschedparam.c, src/pthreadsigmask.c, src/sigaction.c, src/sigaddset.c, src/sigdelset.c, src/sigemptyset.c, src/sigfillset.c, src/sigismember.c, src/signal_2.c, src/sigpending.c, src/sigprocmask.c, src/sigqueue.c, src/sigsuspend.c, src/sigtimedwait.c, src/sigwait.c, src/sigwaitinfo.c, src/ualarm.c: URL for license changed.
  • Property mode set to 100644
File size: 2.2 KB
Line 
1/*  rtems/posix/mutex.inl
2 *
3 *  This include file contains the macro 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.rtems.com/license/LICENSE.
12 *
13 *  $Id$
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#define _POSIX_Mutex_Allocate() \
25  (POSIX_Mutex_Control *) _Objects_Allocate( &_POSIX_Mutex_Information )
26 
27/*PAGE
28 *
29 *  _POSIX_Mutex_Free
30 */
31 
32#define _POSIX_Mutex_Free( _the_mutex ) \
33  _Objects_Free( &_POSIX_Mutex_Information, &(_the_mutex)->Object )
34 
35/*PAGE
36 *
37 *  _POSIX_Mutex_Get
38 *
39 *  NOTE: The support macro makes it possible for both to use exactly
40 *        the same code to check for NULL id pointer and
41 *        PTHREAD_MUTEX_INITIALIZER without adding overhead.
42 */
43
44#define ___POSIX_Mutex_Get_support( _id, _location ) \
45  do { \
46    int _status; \
47    \
48    if ( !_id ) { \
49      *_location = OBJECTS_ERROR; \
50      return (POSIX_Mutex_Control *) 0; \
51    }  \
52    \
53    if ( *_id == PTHREAD_MUTEX_INITIALIZER ) { \
54      /* \
55       *  Do an "auto-create" here. \
56       */ \
57    \
58      _status = pthread_mutex_init( _id, 0 ); \
59      if ( _status ) { \
60        *_location = OBJECTS_ERROR;  \
61        return (POSIX_Mutex_Control *) 0; \
62      } \
63    } \
64  } while (0)
65 
66static POSIX_Mutex_Control * _POSIX_Mutex_Get(
67  Objects_Id        *id,
68  Objects_Locations *location
69)
70{
71  ___POSIX_Mutex_Get_support( id, location );
72
73  return (POSIX_Mutex_Control *)
74    _Objects_Get( &_POSIX_Mutex_Information, *id, location );
75}
76
77static POSIX_Mutex_Control *_POSIX_Mutex_Get_interrupt_disable(
78  Objects_Id        *id,
79  Objects_Locations *location,
80  ISR_Level         *level
81)
82{
83  ___POSIX_Mutex_Get_support( id, location );
84
85  return (POSIX_Mutex_Control *)
86    _Objects_Get_isr_disable( &_POSIX_Mutex_Information, *id, location, level );
87}
88
89 
90/*PAGE
91 *
92 *  _POSIX_Mutex_Is_null
93 */
94 
95#define _POSIX_Mutex_Is_null( _the_mutex ) \
96  (!(_the_mutex))
97
98#endif
99/*  end of include file */
100
Note: See TracBrowser for help on using the repository browser.