1
0

qlock.h 508 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #ifndef _PLAN9_SOURCE
  2. This header file is an extension to ANSI/POSIX
  3. #endif
  4. #ifndef __QLOCK_H_
  5. #define __QLOCK_H_
  6. #pragma lib "/$M/lib/ape/lib9.a"
  7. #include <u.h>
  8. #include <lock.h>
  9. typedef struct QLp QLp;
  10. struct QLp
  11. {
  12. int inuse;
  13. QLp *next;
  14. char state;
  15. };
  16. typedef
  17. struct QLock
  18. {
  19. Lock lock;
  20. int locked;
  21. QLp *head;
  22. QLp *tail;
  23. } QLock;
  24. #ifdef __cplusplus
  25. extern "C" {
  26. #endif
  27. extern void qlock(QLock*);
  28. extern void qunlock(QLock*);
  29. extern int canqlock(QLock*);
  30. #ifdef __cplusplus
  31. }
  32. #endif
  33. #endif