RwLock.hx 972 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. package eval.luv;
  2. /**
  3. Read-write locks.
  4. @see https://aantron.github.io/luv/luv/Luv/Rwlock
  5. **/
  6. @:coreType abstract RwLock {
  7. /**
  8. Allocates and initializes a read-write lock.
  9. **/
  10. static public function init():Result<RwLock>;
  11. /**
  12. Cleans up a read-write lock.
  13. **/
  14. public function destroy():Void;
  15. /**
  16. Takes a read-write lock for reading (shared access).
  17. **/
  18. public function rdLock():Void;
  19. /**
  20. Tries to take a read-write lock for reading without blocking.
  21. **/
  22. public function rdTryLock():Result<Result.NoData>;
  23. /**
  24. Releases a read-write lock after it was taken for reading.
  25. **/
  26. public function rdUnlock():Void;
  27. /**
  28. Takes a read-write lock for writing (exclusive access).
  29. **/
  30. public function wrLock():Void;
  31. /**
  32. Tries to take a read-write lock for writing without blocking.
  33. **/
  34. public function wrTryLock():Result<Result.NoData>;
  35. /**
  36. Releases a read-write lock after it was taken for writing.
  37. **/
  38. public function wrUnlock():Void;
  39. }