CoreMutex.lua 561 B

123456789101112131415161718192021222324252627
  1. class "CoreMutex"
  2. function CoreMutex:__getvar(name)
  3. if name == "mutexID" then
  4. return Polycode.CoreMutex_get_mutexID(self.__ptr)
  5. end
  6. end
  7. function CoreMutex:__setvar(name,value)
  8. if name == "mutexID" then
  9. Polycode.CoreMutex_set_mutexID(self.__ptr, value)
  10. return true
  11. end
  12. return false
  13. end
  14. function CoreMutex:lock()
  15. local retVal = Polycode.CoreMutex_lock(self.__ptr)
  16. end
  17. function CoreMutex:unlock()
  18. local retVal = Polycode.CoreMutex_unlock(self.__ptr)
  19. end
  20. function CoreMutex:__delete()
  21. if self then Polycode.delete_CoreMutex(self.__ptr) end
  22. end