Skip to content

Commit 4823638

Browse files
committed
Improve RTPatchCPU update time (cf. commit 726cd02)
1 parent 8c635d9 commit 4823638

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/slg/engines/rtpathcpu/rtpathcpu.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ void RTPathCPURenderEngine::StartLockLess() {
5151
}
5252

5353
void RTPathCPURenderEngine::StopLockLess() {
54+
// We need to resume paused sessions first,
55+
// otherwise it will hang on a thread barrier.
56+
if(pauseMode)
57+
Resume();
5458
PathCPURenderEngine::StopLockLess();
5559
}
5660

src/slg/engines/rtpathcpu/rtpathcputhread.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,17 +85,13 @@ void RTPathCPURenderThread::RTRenderFunc(std::stop_token stop_token) {
8585
// Synchronize all threads -> This waits for RTPathCPURenderEngine::PauseThreads()
8686
engine->threadsSyncBarrier->arrive_and_wait();
8787

88-
while (!stop_token.stop_requested() && engine->threadsPauseMode)
89-
std::this_thread::sleep_for(100ms);
88+
// Wait for the main thread -> This waits for RTPathCPURenderEngine::ResumeThreads()
89+
engine->threadsSyncBarrier->arrive_and_wait();
9090

91-
// If the above loop was broken because of the stop, we don't want to enter the second
92-
// arrive_and_wait() because that would wait for the resume signal, which won't come.
91+
// If the engine was stopped, we break here.
9392
if (stop_token.stop_requested())
9493
break;
9594

96-
// Wait for the main thread -> This waits for RTPathCPURenderEngine::ResumeThreads()
97-
engine->threadsSyncBarrier->arrive_and_wait();
98-
9995
(static_cast<RTPathCPUSampler *>(sampler.get()))->Reset(FilmPtr(&engine->GetFilm()));
10096
}
10197

0 commit comments

Comments
 (0)