Mutex.hx 581 B

1234567891011121314151617181920212223242526272829303132333435
  1. package eval.luv;
  2. /**
  3. Mutexes.
  4. @see https://aantron.github.io/luv/luv/Luv/Mutex
  5. **/
  6. @:coreType abstract Mutex {
  7. /**
  8. Allocates and initializes a mutex.
  9. **/
  10. static public function init(?recursive:Bool):Result<Mutex>;
  11. /**
  12. Cleans up a mutex.
  13. **/
  14. public function destroy():Void;
  15. /**
  16. Takes the mutex.
  17. The calling thread is blocked until it obtains the mutex.
  18. **/
  19. public function lock():Void;
  20. /**
  21. Tries to take the mutex without blocking.
  22. **/
  23. public function tryLock():Result<Result.NoData>;
  24. /**
  25. Releases the mutex.
  26. **/
  27. public function unlock():Void;
  28. }