20 #ifndef _TINY_DEFINES_H_ 21 #define _TINY_DEFINES_H_ 28 #define PLATFORM_MUTEX pthread_mutex_t 30 #define MUTEX_INIT(x) pthread_mutex_init(&x, NULL) 32 #define MUTEX_LOCK(x) pthread_mutex_lock(&x) 34 #define MUTEX_TRY_LOCK(x) pthread_mutex_trylock(&x) 36 #define MUTEX_UNLOCK(x) pthread_mutex_unlock(&x) 38 #define MUTEX_DESTROY(x) pthread_mutex_destroy(&x) 40 #define PLATFORM_COND pthread_cond_t 42 #define COND_INIT(x) pthread_cond_init(&x, NULL) 44 #define COND_DESTROY(x) pthread_cond_destroy(&x) 46 #define COND_WAIT(cond, mutex) pthread_cond_wait(&cond, &mutex) 48 #define COND_SIGNAL(x) pthread_cond_signal(&x) 50 #define TASK_YIELD() sleep(0) 53 static inline uint16_t PLATFORM_TICKS()
56 clock_gettime(CLOCK_MONOTONIC, &ts);
57 return (ts.tv_sec * 1000) + ts.tv_nsec / 1000000;