| 173 | } |
| 174 | |
| 175 | void TimerManager::start() { |
| 176 | bool doStart = false; |
| 177 | { |
| 178 | Synchronized s(monitor_); |
| 179 | if (!threadFactory_) { |
| 180 | throw InvalidArgumentException(); |
| 181 | } |
| 182 | if (state_ == TimerManager::UNINITIALIZED) { |
| 183 | state_ = TimerManager::STARTING; |
| 184 | doStart = true; |
| 185 | } |
| 186 | } |
| 187 | |
| 188 | if (doStart) { |
| 189 | dispatcherThread_ = threadFactory_->newThread(dispatcher_); |
| 190 | dispatcherThread_->start(); |
| 191 | } |
| 192 | |
| 193 | { |
| 194 | Synchronized s(monitor_); |
| 195 | while (state_ == TimerManager::STARTING) { |
| 196 | monitor_.wait(); |
| 197 | } |
| 198 | assert(state_ != TimerManager::STARTING); |
| 199 | } |
| 200 | } |
| 201 | |
| 202 | void TimerManager::stop() { |
| 203 | bool doStop = false; |
nothing calls this directly
no test coverage detected