@@ -209,6 +209,37 @@ void RJittedFilter::InitNode()
209209 fConcreteFilter ->InitNode ();
210210}
211211
212+ unsigned int &TSlotStack::GetCount ()
213+ {
214+ const auto tid = std::this_thread::get_id ();
215+ {
216+ ROOT::TRWSpinLockReadGuard rg (fRWLock );
217+ auto it = fCountMap .find (tid);
218+ if (fCountMap .end () != it)
219+ return it->second ;
220+ }
221+
222+ {
223+ ROOT::TRWSpinLockWriteGuard rg (fRWLock );
224+ return (fCountMap [tid] = 0U );
225+ }
226+ }
227+ unsigned int &TSlotStack::GetIndex ()
228+ {
229+ const auto tid = std::this_thread::get_id ();
230+
231+ {
232+ ROOT::TRWSpinLockReadGuard rg (fRWLock );
233+ if (fIndexMap .end () != fIndexMap .find (tid))
234+ return fIndexMap [tid];
235+ }
236+
237+ {
238+ ROOT::TRWSpinLockWriteGuard rg (fRWLock );
239+ return (fIndexMap [tid] = std::numeric_limits<unsigned int >::max ());
240+ }
241+ }
242+
212243void TSlotStack::ReturnSlot (unsigned int slotNumber)
213244{
214245 auto &index = GetIndex ();
@@ -217,7 +248,7 @@ void TSlotStack::ReturnSlot(unsigned int slotNumber)
217248 count--;
218249 if (0U == count) {
219250 index = std::numeric_limits<unsigned int >::max ();
220- std::lock_guard< ROOT::TSpinMutex> guard (fMutex );
251+ ROOT::TRWSpinLockWriteGuard guard (fRWLock );
221252 fBuf [fCursor ++] = slotNumber;
222253 R__ASSERT (fCursor <= fBuf .size () &&
223254 " TSlotStack assumes that at most a fixed number of values can be present in the "
@@ -233,7 +264,7 @@ unsigned int TSlotStack::GetSlot()
233264 count++;
234265 if (std::numeric_limits<unsigned int >::max () != index)
235266 return index;
236- std::lock_guard< ROOT::TSpinMutex> guard (fMutex );
267+ ROOT::TRWSpinLockWriteGuard guard (fRWLock );
237268 R__ASSERT (fCursor > 0 &&
238269 " TSlotStack assumes that a value can be always obtained. In this case fCursor is <=0 and this "
239270 " violates such assumption." );
0 commit comments