| 86 | } |
| 87 | |
| 88 | Status StopToken::Poll() const { |
| 89 | if (!impl_) { |
| 90 | return Status::OK(); |
| 91 | } |
| 92 | if (!impl_->requested_.load()) { |
| 93 | return Status::OK(); |
| 94 | } |
| 95 | |
| 96 | std::lock_guard<std::mutex> lock(impl_->mutex_); |
| 97 | if (impl_->cancel_error_.ok()) { |
| 98 | auto signum = impl_->requested_.load(); |
| 99 | DCHECK_GT(signum, 0); |
| 100 | impl_->cancel_error_ = internal::CancelledFromSignal(signum, "Operation cancelled"); |
| 101 | } |
| 102 | return impl_->cancel_error_; |
| 103 | } |
| 104 | |
| 105 | namespace { |
| 106 |