NSLock.odin 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. package objc_Foundation
  2. Locking :: struct($T: typeid) {using _: Object}
  3. Locking_lock :: proc "c" (self: ^Locking($T)) {
  4. msgSend(nil, self, "lock")
  5. }
  6. Locking_unlock :: proc "c" (self: ^Locking($T)) {
  7. msgSend(nil, self, "unlock")
  8. }
  9. @(objc_class="NSCondition")
  10. Condition :: struct {using _: Locking(Condition) }
  11. @(objc_type=Condition, objc_name="alloc", objc_is_class_method=true)
  12. Condition_alloc :: proc "c" () -> ^Condition {
  13. return msgSend(^Condition, Condition, "alloc")
  14. }
  15. @(objc_type=Condition, objc_name="init")
  16. Condition_init :: proc "c" (self: ^Condition) -> ^Condition {
  17. return msgSend(^Condition, self, "init")
  18. }
  19. @(objc_type=Condition, objc_name="wait")
  20. Condition_wait :: proc "c" (self: ^Condition) {
  21. msgSend(nil, self, "wait")
  22. }
  23. @(objc_type=Condition, objc_name="waitUntilDate")
  24. Condition_waitUntilDate :: proc "c" (self: ^Condition, limit: ^Date) -> BOOL {
  25. return msgSend(BOOL, self, "waitUntilDate:", limit)
  26. }
  27. @(objc_type=Condition, objc_name="signal")
  28. Condition_signal :: proc "c" (self: ^Condition) {
  29. msgSend(nil, self, "signal")
  30. }
  31. @(objc_type=Condition, objc_name="broadcast")
  32. Condition_broadcast :: proc "c" (self: ^Condition) {
  33. msgSend(nil, self, "broadcast")
  34. }
  35. @(objc_type=Condition, objc_name="lock")
  36. Condition_lock :: proc "c" (self: ^Condition) {
  37. msgSend(nil, self, "lock")
  38. }
  39. @(objc_type=Condition, objc_name="unlock")
  40. Condition_unlock :: proc "c" (self: ^Condition) {
  41. msgSend(nil, self, "unlock")
  42. }