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

Subversion Repositories openrisc

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
/*  rtems/posix/mutex.h
2
 *
3
 *  This include file contains all the private support information for
4
 *  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.h,v 1.2 2001-09-27 11:59:14 chris Exp $
14
 */
15
 
16
#ifndef __RTEMS_POSIX_MUTEX_h
17
#define __RTEMS_POSIX_MUTEX_h
18
 
19
#ifdef __cplusplus
20
extern "C" {
21
#endif
22
 
23
#include <rtems/score/coremutex.h>
24
#include <pthread.h>
25
 
26
/*
27
 *  Data Structure used to manage a POSIX mutex
28
 */
29
 
30
typedef struct {
31
   Objects_Control     Object;
32
   int                 process_shared;
33
   CORE_mutex_Control  Mutex;
34
}  POSIX_Mutex_Control;
35
 
36
/*
37
 *  The following defines the information control block used to manage
38
 *  this class of objects.
39
 */
40
 
41
POSIX_EXTERN Objects_Information  _POSIX_Mutex_Information;
42
 
43
/*
44
 *  The default mutex attributes structure.
45
 */
46
 
47
extern const pthread_mutexattr_t _POSIX_Mutex_Default_attributes;
48
 
49
/*
50
 *  _POSIX_Mutex_Manager_initialization
51
 *
52
 *  DESCRIPTION:
53
 *
54
 *  This routine performs the initialization necessary for this manager.
55
 */
56
 
57
void _POSIX_Mutex_Manager_initialization(
58
  unsigned32 maximum_mutexes
59
);
60
 
61
/*
62
 *  _POSIX_Mutex_Allocate
63
 *
64
 *  DESCRIPTION:
65
 *
66
 *  This function allocates a mutexes control block from
67
 *  the inactive chain of free mutexes control blocks.
68
 */
69
 
70
RTEMS_INLINE_ROUTINE POSIX_Mutex_Control *_POSIX_Mutex_Allocate( void );
71
 
72
/*
73
 *  _POSIX_Mutex_Free
74
 *
75
 *  DESCRIPTION:
76
 *
77
 *  This routine frees a mutexes control block to the
78
 *  inactive chain of free mutexes control blocks.
79
 */
80
 
81
RTEMS_INLINE_ROUTINE void _POSIX_Mutex_Free (
82
  POSIX_Mutex_Control *the_mutex
83
);
84
 
85
/*
86
 *  _POSIX_Mutex_Get
87
 *
88
 *  DESCRIPTION:
89
 *
90
 *  This function maps mutexes IDs to mutexes control blocks.
91
 *  If ID corresponds to a local mutexes, then it returns
92
 *  the_mutex control pointer which maps to ID and location
93
 *  is set to OBJECTS_LOCAL.  if the mutexes ID is global and
94
 *  resides on a remote node, then location is set to OBJECTS_REMOTE,
95
 *  and the_mutex is undefined.  Otherwise, location is set
96
 *  to OBJECTS_ERROR and the_mutex is undefined.
97
 */
98
 
99
RTEMS_INLINE_ROUTINE POSIX_Mutex_Control *_POSIX_Mutex_Get (
100
  Objects_Id        *id,
101
  Objects_Locations *location
102
);
103
 
104
/*
105
 *  _POSIX_Mutex_Is_null
106
 *
107
 *  DESCRIPTION:
108
 *
109
 *  This function returns TRUE if the_mutex is NULL and FALSE otherwise.
110
 */
111
 
112
RTEMS_INLINE_ROUTINE boolean _POSIX_Mutex_Is_null (
113
  POSIX_Mutex_Control *the_mutex
114
);
115
 
116
/*
117
 *  _POSIX_Mutex_Lock_support
118
 *
119
 *  DESCRIPTION:
120
 *
121
 *  A support routine which implements guts of the blocking, non-blocking, and
122
 *  timed wait version of mutex lock.
123
 */
124
 
125
int _POSIX_Mutex_Lock_support(
126
  pthread_mutex_t           *mutex,
127
  boolean                    blocking,
128
  Watchdog_Interval          timeout
129
);
130
 
131
/*
132
 *  _POSIX_Mutex_From_core_mutex_status
133
 *
134
 *  DESCRIPTION:
135
 *
136
 *  A support routine which converts core mutex status codes into the
137
 *  appropriate POSIX status values.
138
 */
139
 
140
int _POSIX_Mutex_From_core_mutex_status(
141
  CORE_mutex_Status  status
142
);
143
 
144
 
145
#include <rtems/posix/mutex.inl>
146
#if defined(RTEMS_MULTIPROCESSING)
147
#include <rtems/posix/mutexmp.h>
148
#endif
149
 
150
#ifdef __cplusplus
151
}
152
#endif
153
 
154
#endif
155
/*  end of include file */
156
 

powered by: WebSVN 2.1.0

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