Skip to content

Commit

Permalink
[DF] Simplify RTreeColumnReader destructor
Browse files Browse the repository at this point in the history
Since commit 3b623b2 ("[DF] Use dtors to perform clean-up tasks in
column readers"), the destructor resets the std::unique_ptr holding a
TTreaderValue, which is the default of the pointer's destructor.
  • Loading branch information
hahnjo committed Aug 4, 2024
1 parent b3529db commit a038a2f
Showing 1 changed file with 0 additions and 16 deletions.
16 changes: 0 additions & 16 deletions tree/dataframe/inc/ROOT/RDF/RTreeColumnReader.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,6 @@ public:
: fTreeValue(std::make_unique<TTreeReaderValue<T>>(r, colName.c_str()))
{
}

/// The dtor resets the TTreeReaderValue object.
//
// Otherwise a race condition is present in which a TTreeReader
// and its TTreeReader{Value,Array}s can be deleted concurrently:
// - Thread #1) a task ends and pushes back processing slot
// - Thread #2) a task starts and overwrites thread-local TTreeReaderValues
// - Thread #1) first task deletes TTreeReader
// See https://github.com/root-project/root/commit/26e8ace6e47de6794ac9ec770c3bbff9b7f2e945
~RTreeColumnReader() override { fTreeValue.reset(); }
};

/// RTreeColumnReader specialization for TTree values read via TTreeReaderArrays.
Expand Down Expand Up @@ -135,9 +125,6 @@ public:
: fTreeArray(std::make_unique<TTreeReaderArray<T>>(r, colName.c_str()))
{
}

/// See the other class template specializations for an explanation.
~RTreeColumnReader() override { fTreeArray.reset(); }
};

/// RTreeColumnReader specialization for arrays of boolean values read via TTreeReaderArrays.
Expand Down Expand Up @@ -176,9 +163,6 @@ public:
: fTreeArray(std::make_unique<TTreeReaderArray<bool>>(r, colName.c_str()))
{
}

/// See the other class template specializations for an explanation.
~RTreeColumnReader() override { fTreeArray.reset(); }
};

} // namespace RDF
Expand Down

0 comments on commit a038a2f

Please sign in to comment.