| 67 | } |
| 68 | |
| 69 | void Semaphore::post(u32 count) |
| 70 | { |
| 71 | #if CROWN_PLATFORM_WINDOWS |
| 72 | BOOL err = ReleaseSemaphore(_priv->handle, count, NULL); |
| 73 | CE_ASSERT(err != 0, "ReleaseSemaphore: GetLastError = %d", GetLastError()); |
| 74 | CE_UNUSED(err); |
| 75 | #else |
| 76 | pthread_mutex_lock(&_priv->mutex); |
| 77 | for (u32 i = 0; i < count; ++i) { |
| 78 | int err = pthread_cond_signal(&_priv->cond); |
| 79 | CE_ASSERT(err == 0, "pthread_cond_signal: errno = %d", err); |
| 80 | CE_UNUSED(err); |
| 81 | } |
| 82 | |
| 83 | _priv->count += count; |
| 84 | pthread_mutex_unlock(&_priv->mutex); |
| 85 | #endif |
| 86 | } |
| 87 | |
| 88 | void Semaphore::wait() |
| 89 | { |
no test coverage detected