| 62 | } |
| 63 | |
| 64 | void setNumRequired(int numRequired) { |
| 65 | mutex.enter(); |
| 66 | this->numRequired = numRequired; |
| 67 | if (numRequired > 0 && numRequired <= numReached) |
| 68 | fire(); |
| 69 | mutex.leave(); |
| 70 | } |
| 71 | |
| 72 | // Called by each thread to signal that the barrier has been reached. |
| 73 | // Blocks until <numRequired> threads have called this function. |
no test coverage detected