source: rtems/doc/new_chapters/mutex.texi @ 1e524995

4.104.114.84.95
Last change on this file since 1e524995 was 1e524995, checked in by Joel Sherrill <joel.sherrill@…>, on 02/06/98 at 14:14:30

Updated copyrights

  • Property mode set to 100644
File size: 12.1 KB
Line 
1@c
2@c  COPYRIGHT (c) 1988-1998.
3@c  On-Line Applications Research Corporation (OAR).
4@c  All rights reserved.
5@c
6@c  $Id$
7@c
8
9@ifinfo
10@node Mutex Manager, Mutex Manager Introduction, alarm, Top
11@end ifinfo
12@chapter Mutex Manager
13@ifinfo
14@menu
15* Mutex Manager Introduction::
16* Mutex Manager Background::
17* Mutex Manager Operations::
18* Mutex Manager Directives::
19@end menu
20@end ifinfo
21
22@ifinfo
23@node Mutex Manager Introduction, Mutex Manager Background, Mutex Manager, Mutex Manager
24@end ifinfo
25@section Introduction
26
27The mutex manager ...
28
29The directives provided by the mutex manager are:
30
31@itemize @bullet
32@item @code{pthread_mutexattr_init} -
33@item @code{pthread_mutexattr_destroy} -
34@item @code{pthread_mutexattr_setprotocol} -
35@item @code{pthread_mutexattr_getprotocol} -
36@item @code{pthread_mutexattr_setprioceiling} -
37@item @code{pthread_mutexattr_getprioceiling} -
38@item @code{pthread_mutexattr_setpshared} -
39@item @code{pthread_mutexattr_getpshared} -
40@item @code{pthread_mutex_init} -
41@item @code{pthread_mutex_destroy} -
42@item @code{pthread_mutex_lock} -
43@item @code{pthread_mutex_trylock} -
44@item @code{pthread_mutex_timedlock} -
45@item @code{pthread_mutex_unlock} -
46@item @code{pthread_mutex_setprioceiling} -
47@item @code{pthread_mutex_getprioceiling} -
48@end itemize
49
50@ifinfo
51@node Mutex Manager Background, Mutex Manager Operations, Mutex Manager Introduction, Mutex Manager
52@end ifinfo
53@section Background
54
55@ifinfo
56@node Mutex Manager Operations, Mutex Manager Directives, Mutex Manager Background, Mutex Manager
57@end ifinfo
58@section Operations
59
60@ifinfo
61@node Mutex Manager Directives, pthread_mutexattr_init, Mutex Manager Operations, Mutex Manager
62@end ifinfo
63@section Directives
64@ifinfo
65@menu
66* pthread_mutexattr_init::
67* pthread_mutexattr_destroy::
68* pthread_mutexattr_setprotocol::
69* pthread_mutexattr_getprotocol::
70* pthread_mutexattr_setprioceiling::
71* pthread_mutexattr_getprioceiling::
72* pthread_mutexattr_setpshared::
73* pthread_mutexattr_getpshared::
74* pthread_mutex_init::
75* pthread_mutex_destroy::
76* pthread_mutex_lock::
77* pthread_mutex_trylock::
78* pthread_mutex_timedlock::
79* pthread_mutex_unlock::
80* pthread_mutex_setprioceiling::
81* pthread_mutex_getprioceiling::
82@end menu
83@end ifinfo
84
85This section details the mutex manager's directives.
86A subsection is dedicated to each of this manager's directives
87and describes the calling sequence, related constants, usage,
88and status codes.
89
90@page
91@ifinfo
92@node pthread_mutexattr_init, pthread_mutexattr_destroy, Mutex Manager Directives, Mutex Manager Directives
93@end ifinfo
94@subsection pthread_mutexattr_init
95
96@subheading CALLING SEQUENCE:
97
98@example
99#include <pthread.h>
100
101int pthread_mutexattr_init(
102  pthread_mutexattr_t *attr
103);
104@end example
105
106@subheading STATUS CODES:
107
108@table @b
109@item EINVAL
110The attribute pointer argument is invalid.
111
112@end table
113
114@subheading DESCRIPTION:
115
116@subheading NOTES:
117
118@page
119@ifinfo
120@node pthread_mutexattr_destroy, pthread_mutexattr_setprotocol, pthread_mutexattr_init, Mutex Manager Directives
121@end ifinfo
122@subsection pthread_mutexattr_destroy
123
124@subheading CALLING SEQUENCE:
125
126@example
127#include <pthread.h>
128
129int pthread_mutexattr_destroy(
130  pthread_mutexattr_t *attr
131);
132@end example
133
134@subheading STATUS CODES:
135
136@table @b
137@item EINVAL
138The attribute pointer argument is invalid.
139
140@item EINVAL
141The attribute set is not initialized.
142
143@end table
144
145@subheading DESCRIPTION:
146
147@subheading NOTES:
148
149@page
150@ifinfo
151@node pthread_mutexattr_setprotocol, pthread_mutexattr_getprotocol, pthread_mutexattr_destroy, Mutex Manager Directives
152@end ifinfo
153@subsection pthread_mutexattr_setprotocol
154
155@subheading CALLING SEQUENCE:
156
157@example
158#include <pthread.h>
159
160int pthread_mutexattr_setprotocol(
161  pthread_mutexattr_t   *attr,
162  int                    protocol
163);
164@end example
165
166@subheading STATUS CODES:
167
168@table @b
169@item EINVAL
170The attribute pointer argument is invalid.
171
172@item EINVAL
173The attribute set is not initialized.
174 
175@item EINVAL
176The protocol argument is invalid.
177 
178@end table
179
180@subheading DESCRIPTION:
181
182@subheading NOTES:
183
184@page
185@ifinfo
186@node pthread_mutexattr_getprotocol, pthread_mutexattr_setprioceiling, pthread_mutexattr_setprotocol, Mutex Manager Directives
187@end ifinfo
188@subsection pthread_mutexattr_getprotocol
189 
190@subheading CALLING SEQUENCE:
191 
192@example
193#include <pthread.h>
194 
195int pthread_mutexattr_getprotocol(
196  pthread_mutexattr_t   *attr,
197  int                   *protocol
198);
199@end example
200 
201@subheading STATUS CODES:
202 
203@table @b
204@item EINVAL
205The attribute pointer argument is invalid.
206
207@item EINVAL
208The attribute set is not initialized.
209 
210@item EINVAL
211The protocol pointer argument is invalid.
212 
213@end table
214 
215@subheading DESCRIPTION:
216 
217@subheading NOTES:
218
219@page
220@ifinfo
221@node pthread_mutexattr_setprioceiling, pthread_mutexattr_getprioceiling, pthread_mutexattr_getprotocol, Mutex Manager Directives
222@end ifinfo
223@subsection pthread_mutexattr_setprioceiling
224
225@subheading CALLING SEQUENCE:
226
227@example
228#include <pthread.h>
229
230int pthread_mutexattr_setprioceiling(
231  pthread_mutexattr_t   *attr,
232  int                    prioceiling
233);
234@end example
235
236@subheading STATUS CODES:
237 
238@table @b
239@item EINVAL
240The attribute pointer argument is invalid.
241
242@item EINVAL
243The attribute set is not initialized.
244 
245@item EINVAL
246The prioceiling argument is invalid.
247 
248@end table
249
250@subheading DESCRIPTION:
251
252@subheading NOTES:
253
254@page
255@ifinfo
256@node pthread_mutexattr_getprioceiling, pthread_mutexattr_setpshared, pthread_mutexattr_setprioceiling, Mutex Manager Directives
257@end ifinfo
258@subsection pthread_mutexattr_getprioceiling
259
260@subheading CALLING SEQUENCE:
261
262@example
263#include <pthread.h>
264
265int pthread_mutexattr_getprioceiling(
266  const pthread_mutexattr_t   *attr,
267  int                         *prioceiling
268);
269@end example
270
271@subheading STATUS CODES:
272 
273@table @b
274@item EINVAL
275The attribute pointer argument is invalid.
276
277@item EINVAL
278The attribute set is not initialized.
279 
280@item EINVAL
281The prioceiling pointer argument is invalid.
282 
283@end table
284
285@subheading DESCRIPTION:
286
287@subheading NOTES:
288
289@page
290@ifinfo
291@node pthread_mutexattr_setpshared, pthread_mutexattr_getpshared, pthread_mutexattr_getprioceiling, Mutex Manager Directives
292@end ifinfo
293@subsection pthread_mutexattr_setpshared
294
295@subheading CALLING SEQUENCE:
296
297@example
298#include <pthread.h>
299
300int pthread_mutexattr_setpshared(
301  pthread_mutexattr_t   *attr,
302  int                    pshared
303);
304@end example
305
306@subheading STATUS CODES:
307 
308@table @b
309@item EINVAL
310The attribute pointer argument is invalid.
311
312@item EINVAL
313The attribute set is not initialized.
314 
315@item EINVAL
316The pshared argument is invalid.
317 
318@end table
319
320@subheading DESCRIPTION:
321
322@subheading NOTES:
323
324@page
325@ifinfo
326@node pthread_mutexattr_getpshared, pthread_mutex_init, pthread_mutexattr_setpshared, Mutex Manager Directives
327@end ifinfo
328@subsection pthread_mutexattr_getpshared
329
330@subheading CALLING SEQUENCE:
331
332@example
333#include <pthread.h>
334
335int pthread_mutexattr_getpshared(
336  const pthread_mutexattr_t   *attr,
337  int                         *pshared
338);
339@end example
340
341@subheading STATUS CODES:
342 
343@table @b
344@item EINVAL
345The attribute pointer argument is invalid.
346
347@item EINVAL
348The attribute set is not initialized.
349 
350@item EINVAL
351The pshared pointer argument is invalid.
352 
353@end table
354
355@subheading DESCRIPTION:
356
357@subheading NOTES:
358
359@page
360@ifinfo
361@node pthread_mutex_init, pthread_mutex_destroy, pthread_mutexattr_getpshared, Mutex Manager Directives
362@end ifinfo
363@subsection pthread_mutex_init
364
365@subheading CALLING SEQUENCE:
366
367@example
368#include <pthread.h>
369
370int pthread_mutex_init(
371  pthread_mutex_t           *mutex,
372  const pthread_mutexattr_t *attr
373);
374@end example
375
376@subheading STATUS CODES:
377
378@table @b
379@item EINVAL
380The attribute set is not initialized.
381 
382@item EINVAL
383The specified protocol is invalid.
384
385@item EAGAIN
386The system lacked the necessary resources to initialize another mutex.
387
388@item ENOMEM
389Insufficient memory exists to initialize the mutex.
390
391@item EBUSY
392Attempted to reinialize the object reference by mutex, a previously
393initialized, but not yet destroyed.
394
395@end table
396
397@subheading DESCRIPTION:
398
399@subheading NOTES:
400
401@page
402@ifinfo
403@node pthread_mutex_destroy, pthread_mutex_lock, pthread_mutex_init, Mutex Manager Directives
404@end ifinfo
405@subsection pthread_mutex_destroy
406
407@subheading CALLING SEQUENCE:
408
409@example
410#include <pthread.h>
411
412int pthread_mutex_destroy(
413  pthread_mutex_t           *mutex
414);
415@end example
416
417@subheading STATUS CODES:
418 
419@table @b
420@item EINVAL
421The specified mutex is invalid.
422
423@item EBUSY
424Attempted to destroy the object reference by mutex, while it is locked or
425referenced by another thread.
426 
427@end table
428
429@subheading DESCRIPTION:
430
431@subheading NOTES:
432
433@page
434@ifinfo
435@node pthread_mutex_lock, pthread_mutex_trylock, pthread_mutex_destroy, Mutex Manager Directives
436@end ifinfo
437@subsection pthread_mutex_lock
438
439@subheading CALLING SEQUENCE:
440
441@example
442#include <pthread.h>
443
444int pthread_mutex_lock(
445  pthread_mutex_t           *mutex
446);
447@end example
448
449@subheading STATUS CODES:
450
451@table @b
452@item EINVAL
453The specified mutex is invalid.
454
455@item EINVAL
456The mutex has the protocol attribute of PTHREAD_PRIO_PROTECT and the
457priority of the calling thread is higher than the current priority
458ceiling.
459
460@item EDEADLK
461The current thread already owns the mutex.
462
463@end table
464
465@subheading DESCRIPTION:
466
467@subheading NOTES:
468
469@page
470@ifinfo
471@node pthread_mutex_trylock, pthread_mutex_timedlock, pthread_mutex_lock, Mutex Manager Directives
472@end ifinfo
473@subsection pthread_mutex_trylock
474 
475@subheading CALLING SEQUENCE:
476 
477@example
478#include <pthread.h>
479 
480int pthread_mutex_trylock(
481  pthread_mutex_t           *mutex
482);
483@end example
484 
485@subheading STATUS CODES:
486 
487@table @b
488@item EINVAL
489The specified mutex is invalid.
490 
491@item EINVAL
492The mutex has the protocol attribute of PTHREAD_PRIO_PROTECT and the
493priority of the calling thread is higher than the current priority
494ceiling.
495 
496@item EDEADLK
497The current thread already owns the mutex.
498 
499@end table
500 
501@subheading DESCRIPTION:
502 
503@subheading NOTES:
504 
505@page
506@ifinfo
507@node pthread_mutex_timedlock, pthread_mutex_unlock, pthread_mutex_trylock, Mutex Manager Directives
508@end ifinfo
509@subsection pthread_mutex_timedlock
510 
511@subheading CALLING SEQUENCE:
512 
513@example
514#include <pthread.h>
515#include <time.h>
516 
517int pthread_mutex_timedlock(
518  pthread_mutex_t           *mutex,
519  const struct timespec     *timeout
520);
521@end example
522 
523@subheading STATUS CODES:
524 
525@table @b
526@item EINVAL
527The specified mutex is invalid.
528 
529@item EINVAL
530The nanoseconds field of timeout is invalid.
531
532@item EINVAL
533The mutex has the protocol attribute of PTHREAD_PRIO_PROTECT and the
534priority of the calling thread is higher than the current priority
535ceiling.
536 
537@item EDEADLK
538The current thread already owns the mutex.
539
540@end table
541 
542@subheading DESCRIPTION:
543 
544@subheading NOTES:
545 
546
547@page
548@ifinfo
549@node pthread_mutex_unlock,  pthread_mutex_setprioceiling, pthread_mutex_timedlock, Mutex Manager Directives
550@end ifinfo
551@subsection pthread_mutex_unlock
552
553@subheading CALLING SEQUENCE:
554
555@example
556#include <pthread.h>
557
558int pthread_mutex_unlock(
559  pthread_mutex_t           *mutex
560);
561@end example
562
563@subheading STATUS CODES:
564
565@table @b
566@item EINVAL
567The specified mutex is invalid.
568 
569@end table
570
571@subheading DESCRIPTION:
572
573@subheading NOTES:
574
575@page
576@ifinfo
577@node pthread_mutex_setprioceiling, pthread_mutex_getprioceiling, pthread_mutex_unlock, Mutex Manager Directives
578@end ifinfo
579@subsection pthread_mutex_setprioceiling
580
581@subheading CALLING SEQUENCE:
582
583@example
584#include <pthread.h>
585
586int pthread_mutex_setprioceiling(
587  pthread_mutex_t   *mutex,
588  int                prioceiling,
589  int               *oldceiling
590);
591@end example
592
593@subheading STATUS CODES:
594 
595@table @b
596@item EINVAL
597The oldceiling pointer parameter is invalid.
598
599@item EINVAL
600The prioceiling parameter is an invalid priority.
601
602@item EINVAL
603The specified mutex is invalid.
604 
605@end table
606
607@subheading DESCRIPTION:
608
609@subheading NOTES:
610
611@page
612@ifinfo
613@node pthread_mutex_getprioceiling, Condition Variable Manager, pthread_mutex_setprioceiling, Mutex Manager Directives
614@end ifinfo
615@subsection pthread_mutex_getprioceiling
616
617@subheading CALLING SEQUENCE:
618
619@example
620#include <pthread.h>
621
622int pthread_mutex_getprioceiling(
623  pthread_mutex_t   *mutex,
624  int               *prioceiling
625);
626@end example
627
628@subheading STATUS CODES:
629 
630@table @b
631@item EINVAL
632The prioceiling pointer parameter is invalid.
633
634@item EINVAL
635The specified mutex is invalid.
636 
637@end table
638
639@subheading DESCRIPTION:
640
641@subheading NOTES:
642
Note: See TracBrowser for help on using the repository browser.