]> sourceware.org Git - glibc.git/blob - sysdeps/mach/hurd/bits/stdio-lock.h
* sysdeps/mach/sys/reboot.h: Include <features.h>.
[glibc.git] / sysdeps / mach / hurd / bits / stdio-lock.h
1 /* Thread package specific definitions of stream lock type. Hurd version.
2 Copyright (C) 2000 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public
16 License along with the GNU C Library; see the file COPYING.LIB. If not,
17 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. */
19
20 #ifndef _BITS_STDIO_LOCK_H
21 #define _BITS_STDIO_LOCK_H 1
22
23 /* We need recursive (counting) mutexes. Since cthreads doesn't really
24 have them, we implement them just for libio. The implementation is
25 partially here and partially in Hurd's version of cthreads (i.e. the
26 libthreads library, libthreads/lockfile.c). */
27
28 #if (_LIBC - 0) || (_CTHREADS_ - 0)
29 #include <cthreads.h>
30
31 struct _IO_cthreads_lock
32 {
33 struct mutex mutex;
34 cthread_t owner;
35 unsigned int count;
36 };
37 #else
38 struct _IO_cthreads_lock;
39 #endif
40 typedef struct _IO_cthreads_lock _IO_lock_t;
41
42 #define _IO_lock_initializer { MUTEX_INITIALIZER, 0, 0 }
43
44 #define _IO_lock_init(_name) ({ (_name) = (_IO_lock_t) _IO_lock_initializer; })
45 #define _IO_lock_fini(_name) ((void) 0) /* nothing to do */
46
47 /* These are in fact only used for `list_all_lock' (libio/genops.c),
48 which does not need a recursive lock. The per-FILE locks are only
49 accessed through _IO_flockfile et al, which Hurd's libthreads overrides. */
50 #define _IO_lock_lock(_name) __libc_lock_lock ((_name).mutex)
51 #define _IO_lock_unlock(_name) __libc_lock_unlock ((_name).mutex)
52
53 #ifdef _LIBC
54 #include <bits/libc-lock.h>
55
56 #define _IO_cleanup_region_start(_fct, _fp) \
57 __libc_cleanup_region_start (_fct, _fp)
58 #define _IO_cleanup_region_end(_doit) \
59 __libc_cleanup_region_end (_doit)
60 #endif
61
62
63 #endif /* bits/stdio-lock.h */
This page took 0.040597 seconds and 5 git commands to generate.