| 135 | SC::Semaphore::Semaphore(int initialCount) : count(initialCount) {} |
| 136 | |
| 137 | void SC::Semaphore::acquire() |
| 138 | { |
| 139 | mutex.lock(); |
| 140 | while (count == 0) |
| 141 | { |
| 142 | condition.wait(mutex); |
| 143 | } |
| 144 | --count; |
| 145 | mutex.unlock(); |
| 146 | } |
| 147 | |
| 148 | void SC::Semaphore::release() |
| 149 | { |