]> OCCT Git - occt-copy.git/commit
0029935: Foundation Classes - introduce OSD_ThreadPool class defining a thread pool CR0_720_FixS_29935
authorkgv <kgv@opencascade.com>
Sat, 14 Aug 2021 18:42:16 +0000 (21:42 +0300)
committerkgv <kgv@opencascade.com>
Sat, 14 Aug 2021 19:17:13 +0000 (22:17 +0300)
commit5b611a830b6f8dfc0c715f641205b7cb05744235
tree5f0df8471a2a519b3ef18cdc72c4bdfe703db442
parentdde7c61f1380b0efe03afdd0684abdba10fc0f0c
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
19 files changed:
src/BRepMesh/BRepMesh_FastDiscret.cxx
src/BRepMesh/BRepMesh_IncrementalMesh.cxx
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