Skip to content
Snippets Groups Projects
Commit 975db0ee authored by Axel Naumann's avatar Axel Naumann
Browse files

[thread] Make TThreadedObject::fgMaxSlots a struct:

This allows to deprecate the op= instead of any use of fgMaxSlot.
The latter is impossible as TThreadedObject needs to use it itself,
inside an inline (template member) function.
parent 3aad75bf
Branches
Tags
No related merge requests found
...@@ -122,6 +122,18 @@ namespace ROOT { ...@@ -122,6 +122,18 @@ namespace ROOT {
return dirs; return dirs;
} }
}; };
struct MaxSlots_t {
unsigned fVal;
operator unsigned() const { return fVal; }
MaxSlots_t &operator=(unsigned val)
R__DEPRECATED(6, 24, "Superior interface exists: construct TThreadedObject using TNumSlots instead.")
{
fVal = val;
return *this;
}
};
} // End of namespace TThreadedObjectUtils } // End of namespace TThreadedObjectUtils
} // End of namespace Internal } // End of namespace Internal
...@@ -163,8 +175,7 @@ namespace ROOT { ...@@ -163,8 +175,7 @@ namespace ROOT {
public: public:
/// The maximum number of processing slots (distinct threads) which the instances can manage. /// The maximum number of processing slots (distinct threads) which the instances can manage.
/// Deprecated; please use the `TNumSlots` constructor instead. /// Deprecated; please use the `TNumSlots` constructor instead.
static unsigned fgMaxSlots static Internal::TThreadedObjectUtils::MaxSlots_t fgMaxSlots;
R__DEPRECATED(6, 24, "Superior interface exists: construct TThreadedObject using TNumSlots instead.");
TThreadedObject(const TThreadedObject&) = delete; TThreadedObject(const TThreadedObject&) = delete;
...@@ -199,7 +210,7 @@ namespace ROOT { ...@@ -199,7 +210,7 @@ namespace ROOT {
Warning("TThreadedObject()", Warning("TThreadedObject()",
"Use without IMT is deprecated, either enable IMT first, or use constructor overload taking TNumSlots!"); "Use without IMT is deprecated, either enable IMT first, or use constructor overload taking TNumSlots!");
} }
auto nslots = std::max(fgMaxSlots, imtPoolSize); auto nslots = std::max((unsigned)fgMaxSlots, imtPoolSize);
Create(nslots, args...); Create(nslots, args...);
} }
...@@ -336,7 +347,7 @@ namespace ROOT { ...@@ -336,7 +347,7 @@ namespace ROOT {
} }
}; };
template<class T> unsigned TThreadedObject<T>::fgMaxSlots = 64; template<class T> Internal::TThreadedObjectUtils::MaxSlots_t TThreadedObject<T>::fgMaxSlots{64};
} // End ROOT namespace } // End ROOT namespace
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment