Skip to content

Commit 0e7c86b

Browse files
committed
rtpathocl: convert a few shared variables to atomic types
1 parent a922d69 commit 0e7c86b

4 files changed

Lines changed: 10 additions & 9 deletions

File tree

include/slg/editaction.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class EditActionList {
6161
friend std::ostream &operator<<(std::ostream &os, const EditActionList &eal);
6262

6363
private:
64-
u_int actions;
64+
std::atomic<u_int> actions;
6565
};
6666

6767
inline std::ostream &operator<<(std::ostream &os, const EditActionList &eal) {

include/slg/engines/renderengine.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ class RenderEngine {
210210
RenderStateSPtr startRenderState;
211211
FilmPtr startFilm;
212212

213-
bool started, editMode, pauseMode;
213+
std::atomic<bool> started, editMode, pauseMode;
214214

215215
FilterRPtr GetPixelFilter() const { return pixelFilter; }
216216

include/slg/engines/rtpathocl/rtpathocl.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,12 @@ class RTPathOCLRenderEngine : public TilePathOCLRenderEngine {
126126

127127
// Used by RTPathOCLRenderEngine code to sync. with render thread 0
128128
std::barrier<completion_t> *syncBarrier;
129-
RTPathOCLSyncType syncType;
129+
std::atomic<RTPathOCLSyncType> syncType;
130130

131131
// Used by all render threads to sync.
132132
std::barrier<completion_t> *frameBarrier;
133133

134-
double frameTime;
134+
std::atomic<double> frameTime;
135135
};
136136

137137
}

src/slg/engines/rtpathocl/rtpathoclthread.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -298,12 +298,13 @@ void RTPathOCLRenderThread::RenderThreadImpl(std::stop_token stop_token) {
298298

299299
// Check if we are in pause mode
300300
if (engine->pauseMode) {
301-
if (requestedStop)
302-
break;
301+
if (requestedStop)
302+
break;
303303

304-
std::this_thread::sleep_for(100ms);
305-
} else
306-
break;
304+
std::this_thread::sleep_for(100ms);
305+
} else {
306+
break;
307+
}
307308
}
308309

309310
// Re-initialize the tile queue for the next frame

0 commit comments

Comments
 (0)