source: rtems/cpukit/posix/inline/rtems/posix/rwlock.inl @ 3507c6df

4.104.115
Last change on this file since 3507c6df was 3507c6df, checked in by Joel Sherrill <joel.sherrill@…>, on 01/05/09 at 20:26:01

2009-01-05 Joel Sherrill <joel.sherrill@…>

  • libcsupport/src/gxx_wrappers.c, posix/include/mqueue.h, posix/include/rtems/posix/semaphore.h, posix/inline/rtems/posix/barrier.inl, posix/inline/rtems/posix/key.inl, posix/inline/rtems/posix/mqueue.inl, posix/inline/rtems/posix/rwlock.inl, posix/inline/rtems/posix/semaphore.inl, posix/inline/rtems/posix/spinlock.inl, posix/inline/rtems/posix/timer.inl, posix/src/condget.c, posix/src/mqueuenametoid.c, posix/src/mutexget.c, posix/src/semaphorenametoid.c, posix/src/semopen.c, sapi/src/itronapi.c, sapi/src/posixapi.c: Make changes necessary for all tests to run on SPARC with 16-bit Ids. This required ensuring that all POSIX and compilering binding code makes a distinction between the public Id type (e.g. pthread_t, etc.) and the RTEMS Object_Id type. All POSIX Object Get routines should not take the POSIX Id type as the argument. Sixteen bit RTEMS Ids should be placed into the 32-bits reserved by the POSIX API type in a uniform manner now. This removed all assumptions that the external Id types in POSIX and ITRON are the same as the internal Object Id type.
  • Property mode set to 100644
File size: 2.2 KB
Line 
1/**
2 * @file rtems/posix/RWLock.inl
3 */
4
5/*
6 *  This file contains the static inlin implementation of the inlined
7 *  routines from the POSIX RWLock Manager.
8 *
9 *  COPYRIGHT (c) 1989-2006.
10 *  On-Line Applications Research Corporation (OAR).
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.rtems.com/license/LICENSE.
15 *
16 *  $Id$
17 */
18
19#ifndef _RTEMS_POSIX_RWLOCK_H
20# error "Never use <rtems/posix/rwlock.inl> directly; include <rtems/posix/rwlock.h> instead."
21#endif
22
23#ifndef _RTEMS_POSIX_RWLOCK_INL
24#define _RTEMS_POSIX_RWLOCK_INL
25
26#include <pthread.h>
27
28/**
29 *  @brief _POSIX_RWLock_Allocate
30 *
31 *  This function allocates a RWLock control block from
32 *  the inactive chain of free RWLock control blocks.
33 */
34RTEMS_INLINE_ROUTINE POSIX_RWLock_Control *_POSIX_RWLock_Allocate( void )
35{
36  return (POSIX_RWLock_Control *)
37    _Objects_Allocate( &_POSIX_RWLock_Information );
38}
39
40/**
41 *  @brief _POSIX_RWLock_Free
42 *
43 *  This routine frees a RWLock control block to the
44 *  inactive chain of free RWLock control blocks.
45 */
46RTEMS_INLINE_ROUTINE void _POSIX_RWLock_Free (
47  POSIX_RWLock_Control *the_RWLock
48)
49{
50  _Objects_Free( &_POSIX_RWLock_Information, &the_RWLock->Object );
51}
52
53/**
54 *  @brief _POSIX_RWLock_Get
55 *
56 *  This function maps RWLock IDs to RWLock control blocks.
57 *  If ID corresponds to a local RWLock, then it returns
58 *  the_RWLock control pointer which maps to ID and location
59 *  is set to OBJECTS_LOCAL.  if the RWLock ID is global and
60 *  resides on a remote node, then location is set to OBJECTS_REMOTE,
61 *  and the_RWLock is undefined.  Otherwise, location is set
62 *  to OBJECTS_ERROR and the_RWLock is undefined.
63 */
64RTEMS_INLINE_ROUTINE POSIX_RWLock_Control *_POSIX_RWLock_Get (
65  pthread_rwlock_t *RWLock,
66  Objects_Locations *location
67)
68{
69  return (POSIX_RWLock_Control *) _Objects_Get(
70      &_POSIX_RWLock_Information,
71      (Objects_Id) *RWLock,
72      location
73  );
74}
75
76/**
77 *  @brief _POSIX_RWLock_Is_null
78 *
79 *  This function returns TRUE if the_RWLock is NULL and FALSE otherwise.
80 */
81RTEMS_INLINE_ROUTINE bool _POSIX_RWLock_Is_null (
82  POSIX_RWLock_Control *the_RWLock
83)
84{
85  return ( the_RWLock == NULL );
86}
87
88#endif
89/*  end of include file */
Note: See TracBrowser for help on using the repository browser.