0029935: Foundation Classes - introduce OSD_ThreadPool class defining a thread pool
authorkgv <kgv@opencascade.com>
Fri, 6 Jul 2018 23:27:51 +0000 (02:27 +0300)
committerbugmaster <bugmaster@opencascade.com>
Fri, 13 Jul 2018 13:38:06 +0000 (16:38 +0300)
commit6f498847fa9c31e473ae528ba6d05944da679f8a
treebfd03169db329b6406bc80fbf80a1fd0afb87d60
parentbe3d8cbc020dba1aa1859274ff6ad388d0707694
0029935: Foundation Classes - introduce OSD_ThreadPool class defining a thread pool

New class OSD_ThreadPool has been introduced to define a Thread Pool for multi-threading algorithm.
Thread Pool assigns a serial number for each thread allowing Multi-Threading algorithm to allocate thread-local storage variables as an array whose size is the same as the number of threads.

OSD_ThreadPool also redirects exceptions to a thread calling parallel execution and consistently initializes FPE exception handling.

New class Standard_Condition provides a platform-independent  tool similar to Event in WinAPI.

A new auxiliary function Standard_Atomic_CompareAndSwap() has been introduced
for performing atomic compare and swap of integer number.
Standard_Atomic_Increment/Standard_Atomic_Decrement fallback implementation
using ASM code for x86 processors for GCC has been dropped;
instead, it is expected that GCC should be properly configured targeting modern x86 architectures.

OSD_Signal now declares fFltExceptions as thread_local variable accessible through OSD::ToCatchFloatingSignals() property.
Standard_THREADLOCAL macro (wrapping thread_local attribute) has been moved to public header Standard_Macro.hxx.

OSD_Parallel::ForEach() has been extended with new optional parameter theNbItems and uses OSD_ThreadPool::DefaultPool().
17 files changed:
src/BRepMesh/BRepMesh_FastDiscret.cxx
src/BRepMesh/BRepMesh_IncrementalMesh.cxx
src/OSD/FILES
src/OSD/OSD.hxx
src/OSD/OSD_Parallel.hxx
src/OSD/OSD_Parallel_TBB.cxx
src/OSD/OSD_Parallel_Threads.cxx
src/OSD/OSD_ThreadPool.cxx [new file with mode: 0644]
src/OSD/OSD_ThreadPool.hxx [new file with mode: 0644]
src/OSD/OSD_signal.cxx
src/QABugs/QABugs_19.cxx
src/Standard/FILES
src/Standard/Standard_Atomic.hxx
src/Standard/Standard_Condition.cxx [new file with mode: 0644]
src/Standard/Standard_Condition.hxx [new file with mode: 0644]
src/Standard/Standard_Failure.cxx
src/Standard/Standard_Macro.hxx