| 227 | } |
| 228 | |
| 229 | void cbm_mutex_lock(cbm_mutex_t *m) { |
| 230 | #if defined(CBM_MEMWASTE) && CBM_MEMWASTE |
| 231 | if (cbm_memev_enabled()) { |
| 232 | bool contended = !TryEnterCriticalSection(&m->cs); |
| 233 | if (contended) { |
| 234 | EnterCriticalSection(&m->cs); |
| 235 | } |
| 236 | cbm_work_note(CBM_WORK_MUTEX, __builtin_return_address(0), 0, contended ? 1 : 0, 0); |
| 237 | return; |
| 238 | } |
| 239 | #endif |
| 240 | EnterCriticalSection(&m->cs); |
| 241 | } |
| 242 | |
| 243 | void cbm_mutex_unlock(cbm_mutex_t *m) { |
| 244 | LeaveCriticalSection(&m->cs); |