Skip to content

Foundation Classes - Rework atomic and Standard_Condition#598

Merged
dpasukhi merged 2 commits intoOpen-Cascade-SAS:IRfrom
dpasukhi:atomic_removing
Jul 10, 2025
Merged

Foundation Classes - Rework atomic and Standard_Condition#598
dpasukhi merged 2 commits intoOpen-Cascade-SAS:IRfrom
dpasukhi:atomic_removing

Conversation

@dpasukhi
Copy link
Copy Markdown
Member

@dpasukhi dpasukhi commented Jul 9, 2025

Refactor atomic operations to use std::atomic for thread safety and performance improvements
Update Standard_Condition to use std::condition_variable for better synchronization

Refactor atomic operations to use std::atomic for thread safety and performance improvements
Update Standard_Condition to use std::condition_variable for better synchronization
…Atomic, Graphic3d_Camera, and Select3D_SensitivePrimitiveArray
@dpasukhi dpasukhi marked this pull request as ready for review July 10, 2025 07:52
@dpasukhi dpasukhi added this to the Release 8.0 milestone Jul 10, 2025
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR modernizes atomic counters by switching from Standard_Atomic to std::atomic across multiple modules and refactors Standard_Condition to use C++ standard threading primitives instead of platform-specific APIs.

  • Replace all Standard_Atomic_Increment/Decrement calls and volatile counters with std::atomic usage.
  • Rewrite Standard_Condition header to use std::mutex, std::condition_variable, and std::atomic<bool>; remove its implementation file.
  • Update build files (CMake lists) and deprecate old atomic APIs in Standard_Atomic.hxx.

Reviewed Changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/Visualization/TKV3d/Select3D/Select3D_SensitivePrimitiveArray.cxx Swapped Standard_Atomic for std::atomic on myNbFailures.
src/Visualization/TKService/Graphic3d/Graphic3d_TextureRoot.cxx Changed static counter to std::atomic and prefix‐increment.
src/Visualization/TKService/Graphic3d/Graphic3d_ShaderProgram.cxx Same atomic counter refactor.
src/Visualization/TKService/Graphic3d/Graphic3d_ShaderObject.cxx Same atomic counter refactor.
src/Visualization/TKService/Graphic3d/Graphic3d_MarkerImage.cxx Same atomic counter refactor for marker IDs.
src/Visualization/TKService/Graphic3d/Graphic3d_HatchStyle.cxx Same atomic counter refactor for hatch styles.
src/Visualization/TKService/Graphic3d/Graphic3d_ClipPlane.cxx Same atomic counter refactor for clip planes.
src/Visualization/TKService/Graphic3d/Graphic3d_Camera.cxx Same atomic counter refactor for camera state IDs.
src/Visualization/TKService/Graphic3d/Graphic3d_CLight.cxx Same atomic counter refactor for light IDs.
src/FoundationClasses/TKernel/Standard/Standard_Condition.hxx Replaced platform-specific condition/event code with STL types.
src/FoundationClasses/TKernel/Standard/Standard_Condition.cxx Removed old pthread/Win32 implementation file.
src/FoundationClasses/TKernel/Standard/Standard_Atomic.hxx Added deprecation macros and includes for <atomic>.
src/FoundationClasses/TKernel/Standard/FILES.cmake Removed Standard_Condition.cxx from build list.
src/FoundationClasses/TKernel/OSD/OSD_ThreadPool.hxx Updated volatile int and atomic helpers to std::atomic<int>.
src/FoundationClasses/TKernel/OSD/OSD_ThreadPool.cxx Replaced Standard_Atomic_CompareAndSwap with exchange/store.
src/Draw/TKQADraw/QABugs/QABugs_19.cxx Updated test atomics to use std::atomic<int>.
src/Draw/TKQADraw/QABugs/QABugs_11.cxx Updated test atomics to use std::atomic<Standard_Integer>.
Comments suppressed due to low confidence (1)

src/FoundationClasses/TKernel/Standard/Standard_Condition.hxx:36

  • The Standard_EXPORT specifier was removed from the constructor (and other methods), which can break symbol visibility on Windows. Please re-apply Standard_EXPORT to public methods to preserve the library's ABI.
  Standard_Condition(bool theIsSet = false)

@github-project-automation github-project-automation bot moved this from Todo to Integration in Maintenance Jul 10, 2025
@dpasukhi dpasukhi merged commit 9707a15 into Open-Cascade-SAS:IR Jul 10, 2025
23 checks passed
@dpasukhi dpasukhi deleted the atomic_removing branch July 10, 2025 09:10
@github-project-automation github-project-automation bot moved this from Integration to Done in Maintenance Jul 10, 2025
@dpasukhi dpasukhi added the 1. Foundation Classes Containers, system calls wrappers, smart pointers and other low level of OCCT code label Jul 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1. Foundation Classes Containers, system calls wrappers, smart pointers and other low level of OCCT code

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants