A reasonably simple easy hack to add an API to fetch an optimal number of threads (presumably the same as the core count usually ;) That is needed to setup optimal parallelism in calc XLSX loading eg.
sal_Int32 nThreads = std::min( rSheets.size(), (size_t) 4 /* FIXME: ncpus/2 */ );
Notice the '4' ;-)
not ideal - clearly.
The API should live inside sal/osl/ and include/osl/ and just wrap thinly the underlying OS parameters without being hyper-complicated.
can we directly use Boost's approximation of C++11 std::thread::hardware_concurrency for that, see <http://www.boost.org/doc/libs/1_55_0/doc/html/thread/thread_management.html#thread.thread_management.thread.hardware_concurrency>?
I guess that means linking to and/or distributing boost's thread library (?) or is that method effectively in-lined ?
Either way - given that as we start to use more threading anyway, having boost threads around would be rather helpful - it'd be great to have that usable. It seems we have StaticLibrary_boostthread - but ... do we link it anywhere already ? or ...
'git grep boost/thread' seems to show nothing =)
Since we allow C++11 now, we could use std::thread::hardware_concurrency directly. However, do we even need a API wrapper for this as this is standard C++11?
@Michael: Also there is already a comphelper::ThreadPool wrapper, do we need another one?
All good points; lets just close this now - we are using the std:: API currently.
Migrating Whiteboard tags to Keywords: (EasyHack,DifficultyBeginner,SkillCpp,TopicCleanup)
Remove LibreOffice Dev List from CC on EasyHacks
(curtailing excessive email to list)