]> OCCT Git - occt.git/commit
0029935: Foundation Classes - introduce OSD_ThreadPool class defining a thread pool
authoroan <oan@opencascade.com>
Mon, 16 Jan 2023 11:57:54 +0000 (14:57 +0300)
committeroan <oan@opencascade.com>
Mon, 16 Jan 2023 11:57:54 +0000 (14:57 +0300)
commit6025bf98df58aba4f2f064911a7b1de25189e8b2
tree097cf20f7d1a8c8a6881dce16ed2c31099f7abc0
parent61e28109925c6e4fb0dfaab1fd70656be53b0284
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().

# Conflicts:
# src/BRepMesh/BRepMesh_IncrementalMesh.cxx
# src/OSD/OSD_signal.cxx
# src/Standard/Standard_Failure.cxx
# src/Standard/Standard_Macro.hxx

# Conflicts:
# src/BRepMesh/BRepMesh_FastDiscret.cxx
# src/BRepMesh/BRepMesh_IncrementalMesh.cxx
17 files changed:
src/NCollection/NCollection_Array1.hxx
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/Poly/Poly_Connect.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