tensorflow/core/kernels/conditional_accumulator_base.cc
/**
 * Try to flush logged, blocked TakeGrad attempts.
 */
Try to flush logged, blocked TakeGrad attempts.
Try to flush logged blocked TakeGrad attempts .
void ConditionalAccumulatorBase::FlushUnlocked() {
  std::vector<CleanUp> clean_up;
  Ref();
  {
    mutex_lock lock(mu_);
    bool changed;
    do {
      changed = TryAttemptLocked(&clean_up);
    } while (changed);
  }
  Unref();
  for (const auto& to_clean : clean_up) {
    if (to_clean.to_deregister != CancellationManager::kInvalidToken) {
      to_clean.cm->DeregisterCallback(to_clean.to_deregister);
    }
    to_clean.finished();
  }
}
void ConditionalAccumulatorBase :: FlushUnlocked ( ) { std :: vector < CleanUp > clean_up ; Ref ( ) ; { mutex_lock lock ( mu_ ) ; bool changed ; do { changed = TryAttemptLocked ( & clean_up ) ; } while ( changed ) ; } Unref ( ) ; for ( const auto & to_clean : clean_up ) { if ( to_clean . to_deregister != CancellationManager :: kInvalidToken ) { to_clean . cm -> DeregisterCallback ( to_clean . to_deregister ) ; } to_clean . finished ( ) ; } }
Try to flush logged, blocked TakeGrad attempts.
Try to flush logged blocked TakeGrad attempts .
// NOTE(mrry): We can safely ignore the return value of // DeregisterCallback because the mutex mu_ ensures that the // cleanup action only executes once.