| 312 | } |
| 313 | |
| 314 | void QueueBase::FlushUnlocked() { |
| 315 | std::vector<CleanUp> clean_up; |
| 316 | Ref(); |
| 317 | { |
| 318 | mutex_lock lock(mu_); |
| 319 | bool changed; |
| 320 | do { |
| 321 | changed = TryAttemptLocked(kEnqueue, &clean_up); |
| 322 | changed = TryAttemptLocked(kDequeue, &clean_up) || changed; |
| 323 | } while (changed); |
| 324 | } |
| 325 | Unref(); |
| 326 | for (const auto& to_clean : clean_up) { |
| 327 | if (to_clean.to_deregister != CancellationManager::kInvalidToken) { |
| 328 | // NOTE(mrry): We can safely ignore the return value of |
| 329 | // DeregisterCallback because the mutex mu_ ensures that the |
| 330 | // cleanup action only executes once. |
| 331 | to_clean.cm->DeregisterCallback(to_clean.to_deregister); |
| 332 | } |
| 333 | to_clean.finished(); |
| 334 | } |
| 335 | } |
| 336 | |
| 337 | Status QueueBase::CopySliceToElement(const Tensor& parent, Tensor* element, |
| 338 | int64 index) { |
nothing calls this directly
no test coverage detected