github.com/moontrade/nogc@v0.1.7/sync/lock.h (about) 1 #ifndef MOONTRADE_LOCK_H 2 #define MOONTRADE_LOCK_H 3 4 #include <stdint.h> 5 #include <stdlib.h> 6 7 #ifdef __cplusplus 8 extern "C" { 9 #endif 10 11 12 typedef struct moontrade_rwlock_t { 13 void (*lock)(size_t arg0, size_t arg1); 14 } moontrade_rwlock_t; 15 16 extern void moontrade_lock_sleep(uint64_t nanos); 17 extern uint64_t moontrade_rwlock_size(); 18 extern void moontrade_rwlock_new(size_t arg0, size_t arg1); 19 extern void moontrade_rwlock_try_lock(size_t lock, size_t arg1); 20 extern void moontrade_rwlock_lock(size_t arg0, size_t arg1); 21 extern void moontrade_rwlock_unlock(size_t lock, size_t arg1); 22 extern void moontrade_rwlock_unlock_and_lock_shared(size_t lock, size_t arg1); 23 extern void moontrade_rwlock_try_lock_shared(size_t lock, size_t arg1); 24 extern void moontrade_rwlock_lock_shared(size_t lock, size_t arg1); 25 extern void moontrade_rwlock_unlock_shared(size_t lock, size_t arg1); 26 extern void moontrade_rwlock_destroy(size_t lock, size_t arg1); 27 28 typedef struct moontrade_rwticketlock_t moontrade_rwticketlock_t; 29 30 extern uint64_t moontrade_rwticketlock_size(); 31 extern void moontrade_rwticketlock_new(size_t arg0, size_t arg1); 32 extern void moontrade_rwticketlock_lock(size_t lock, size_t arg1); 33 extern void moontrade_rwticketlock_lock_aggressive(size_t lock, size_t arg1); 34 extern void moontrade_rwticketlock_lock_nice(size_t lock, size_t arg1); 35 extern void moontrade_rwticketlock_unlock(size_t lock, size_t arg1); 36 extern void moontrade_rwticketlock_unlock_and_lock_shared(size_t lock, size_t arg1); 37 extern void moontrade_rwticketlock_try_lock(size_t lock, size_t arg1); 38 extern void moontrade_rwticketlock_try_lock_shared(size_t lock, size_t arg1); 39 extern void moontrade_rwticketlock_lock_shared(size_t lock, size_t arg1); 40 extern void moontrade_rwticketlock_unlock_shared(size_t lock, size_t arg1); 41 extern void moontrade_rwticketlock_destroy(size_t lock, size_t arg1); 42 43 #ifdef __cplusplus 44 } 45 #endif 46 47 #endif //MOONTRADE_LOCK_H