| 83 | } |
| 84 | |
| 85 | void cancel() |
| 86 | { |
| 87 | // Store time of first cancellation. We use `compare_exchange_weak()` |
| 88 | // to avoid unwanted updates on subsequent calls. |
| 89 | std::chrono::steady_clock::rep epoch( 0 ); |
| 90 | m_cancellationTime.compare_exchange_weak( |
| 91 | epoch, |
| 92 | std::chrono::steady_clock::now().time_since_epoch().count() |
| 93 | ); |
| 94 | // Set cancellation flag _after_ storing time, so that |
| 95 | // `elapsedTime()` always sees a valid time. |
| 96 | m_cancelled = true; |
| 97 | } |
| 98 | |
| 99 | bool cancelled() const |
| 100 | { |
no outgoing calls