Commit fc04f0a3 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

ParserService: Provide a shared helper to fetch the number of logical threads

parent 306fafe1
......@@ -92,6 +92,14 @@ MediaLibrary* ParserService::mediaLibrary()
return m_ml;
}
uint8_t ParserService::nbNativeThreads() const
{
auto nbProcs = std::thread::hardware_concurrency();
if ( nbProcs == 0 )
return 1;
return nbProcs;
}
bool ParserService::initialize()
{
return true;
......
......@@ -47,6 +47,7 @@ public:
protected:
MediaLibrary* mediaLibrary();
uint8_t nbNativeThreads() const;
/// Can be overriden to run service dependent initializations
virtual bool initialize();
virtual parser::Task::Status run( parser::Task& task ) = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment