message: [tf.data] Patch for thread safe IgnoreErrorDataset.
diff: @@ -79,6 +79,8 @@ class IgnoreErrorsDatasetOp : public UnaryDatasetOpKernel {
  Status GetNextInternal(IteratorContext* ctx,
  std::vector<Tensor>* out_tensors,
  bool* end_of_sequence) override {
  + {
  + tf_shared_lock l(mu_);
  if (!input_impl_) {
  *end_of_sequence = true;
  return Status::OK();
  @@ -88,7 +90,9 @@ class IgnoreErrorsDatasetOp : public UnaryDatasetOpKernel {
  out_tensors->clear();
  s = input_impl_->GetNext(ctx, out_tensors, end_of_sequence);
  }
  + }
  if (*end_of_sequence) {
  + mutex_lock l(mu_);
  input_impl_.reset();
  }
  return Status::OK();
  @@ -96,6 +100,7 @@ class IgnoreErrorsDatasetOp : public UnaryDatasetOpKernel {
  protected:
  Status SaveInternal(IteratorStateWriter* writer) override {
  + mutex_lock l(mu_);
  if (input_impl_)
  TF_RETURN_IF_ERROR(SaveParent(writer, input_impl_));
  else
  @@ -106,6 +111,7 @@ class IgnoreErrorsDatasetOp : public UnaryDatasetOpKernel {
  Status RestoreInternal(OpKernelContext* ctx,
  IteratorStateReader* reader) override {
  + mutex_lock l(mu_);
  if (reader->Contains(full_name("input_impls_empty")))
  input_impl_.reset();
  else
  @@ -114,7 +120,8 @@ class IgnoreErrorsDatasetOp : public UnaryDatasetOpKernel {
  }
  private:
  - std::unique_ptr<IteratorBase> input_impl_;
  + mutex mu_;
  + std::unique_ptr<IteratorBase> input_impl_ GUARDED_BY(mu_);
  };
  const DatasetBase* const input_;
  