The open source OpenXR runtime

os/threading: Add os_cond wrapper

authored by

Jakob Bornecrantz and committed by
Moses Turner
76d89447 78940399

+48
+48
src/xrt/auxiliary/os/os_threading.h
··· 99 99 100 100 /* 101 101 * 102 + * Conditional variable. 103 + * 104 + */ 105 + struct os_cond 106 + { 107 + pthread_cond_t cond; 108 + }; 109 + 110 + /*! 111 + * Init. 112 + */ 113 + static inline int 114 + os_cond_init(struct os_cond *oc) 115 + { 116 + return pthread_cond_init(&oc->cond, NULL); 117 + } 118 + 119 + /*! 120 + * Signal. 121 + */ 122 + static inline void 123 + os_cond_signal(struct os_cond *oc) 124 + { 125 + pthread_cond_signal(&oc->cond); 126 + } 127 + 128 + /*! 129 + * Wait. 130 + */ 131 + static inline void 132 + os_cond_wait(struct os_cond *oc, struct os_mutex *om) 133 + { 134 + pthread_cond_wait(&oc->cond, &om->mutex); 135 + } 136 + 137 + /*! 138 + * Clean up. 139 + */ 140 + static inline void 141 + os_cond_destroy(struct os_cond *oc) 142 + { 143 + pthread_cond_destroy(&oc->cond); 144 + } 145 + 146 + 147 + 148 + /* 149 + * 102 150 * Thread. 103 151 * 104 152 */