stdio-lock.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /* Thread package specific definitions of stream lock type. Generic version.
  2. Copyright (C) 2000, 2001 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. The GNU C Library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with the GNU C Library; if not, write to the Free
  14. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  15. 02111-1307 USA. */
  16. #ifndef _BITS_STDIO_LOCK_H
  17. #define _BITS_STDIO_LOCK_H 1
  18. #include <bits/libc-lock.h>
  19. __libc_lock_define_recursive (typedef, _IO_lock_t)
  20. /* We need recursive (counting) mutexes. */
  21. #ifdef _LIBC_LOCK_RECURSIVE_INITIALIZER
  22. # define _IO_lock_initializer _LIBC_LOCK_RECURSIVE_INITIALIZER
  23. #elif _IO_MTSAFE_IO
  24. #error libio needs recursive mutexes for _IO_MTSAFE_IO
  25. #endif
  26. #define _IO_lock_init(_name) __libc_lock_init_recursive (_name)
  27. #define _IO_lock_fini(_name) __libc_lock_fini_recursive (_name)
  28. #define _IO_lock_lock(_name) __libc_lock_lock_recursive (_name)
  29. #define _IO_lock_unlock(_name) __libc_lock_unlock_recursive (_name)
  30. #define _IO_cleanup_region_start(_fct, _fp) \
  31. __libc_cleanup_region_start (((_fp)->_flags & _IO_USER_LOCK) == 0, _fct, _fp)
  32. #define _IO_cleanup_region_start_noarg(_fct) \
  33. __libc_cleanup_region_start (1, _fct, NULL)
  34. #define _IO_cleanup_region_end(_doit) \
  35. __libc_cleanup_region_end (_doit)
  36. #endif /* bits/stdio-lock.h */