1
0

lock.h 845 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. * This file is part of the UCB release of Plan 9. It is subject to the license
  3. * terms in the LICENSE file found in the top-level directory of this
  4. * distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
  5. * part of the UCB release of Plan 9, including this file, may be copied,
  6. * modified, propagated, or distributed except according to the terms contained
  7. * in the LICENSE file.
  8. */
  9. #if !defined(_RESEARCH_SOURCE) && !defined(_PLAN9_SOURCE)
  10. This header file is an extension of ANSI/POSIX
  11. #endif
  12. #ifndef __LOCK_H
  13. #define __LOCK_H
  14. #pragma lib "/$M/lib/ape/libap.a"
  15. #include <u.h>
  16. typedef struct
  17. {
  18. int32_t key;
  19. int32_t sem;
  20. } Lock;
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24. extern void lock(Lock*);
  25. extern void unlock(Lock*);
  26. extern int canlock(Lock*);
  27. extern int tas(int*);
  28. #ifdef __cplusplus
  29. }
  30. #endif
  31. #endif