CoreMutex.lua 565 B

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