Skip to content

Commit a7f5c1b

Browse files
committed
Add some checks to TaskList::Shutdown()/FinishShutdown()
1 parent cb91114 commit a7f5c1b

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/engine/renderer-vulkan/Thread/TaskList.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,21 @@ void TaskList::Init() {
8686
}
8787

8888
void TaskList::Shutdown() {
89+
if ( exiting.load( std::memory_order_relaxed ) ) {
90+
Log::WarnTag( "Shutdown() has already been called!" );
91+
return;
92+
}
93+
8994
executingThreads.fetch_sub( 1, std::memory_order_relaxed );
9095
exiting.store( true, std::memory_order_relaxed );
9196
}
9297

9398
void TaskList::FinishShutdown() {
99+
if ( !TLM.main ) {
100+
Log::WarnTag( "FinishShutdown() can only be called from the main thread!" );
101+
return;
102+
}
103+
94104
for ( Thread* thread = threads; thread < threads + currentMaxThreads; thread++ ) {
95105
thread->Exit();
96106
}

0 commit comments

Comments
 (0)