| 20 | namespace oneflow { |
| 21 | |
| 22 | NotifierStatus Notifier::Notify() { |
| 23 | bool notify = false; |
| 24 | { |
| 25 | std::unique_lock<std::mutex> lock(mutex_); |
| 26 | if (is_closed_) { return kNotifierStatusErrorClosed; } |
| 27 | notify = (notified_cnt_ == 0); |
| 28 | ++notified_cnt_; |
| 29 | } |
| 30 | if (notify) { cond_.notify_one(); } |
| 31 | return kNotifierStatusSuccess; |
| 32 | } |
| 33 | |
| 34 | NotifierStatus Notifier::WaitAndClearNotifiedCnt() { |
| 35 | std::unique_lock<std::mutex> lock(mutex_); |
no outgoing calls
no test coverage detected