gpu: Add shut down method to synchronize threads before destruction
This commit is contained in:
parent
8badb6f4a7
commit
664fcdc64b
3 changed files with 15 additions and 0 deletions
|
@ -312,6 +312,12 @@ struct GPU::Impl {
|
|||
cpu_context->MakeCurrent();
|
||||
}
|
||||
|
||||
void NotifyShutdown() {
|
||||
std::unique_lock lk{sync_mutex};
|
||||
shutting_down.store(true, std::memory_order::relaxed);
|
||||
sync_cv.notify_all();
|
||||
}
|
||||
|
||||
/// Obtain the CPU Context
|
||||
void ObtainContext() {
|
||||
cpu_context->MakeCurrent();
|
||||
|
@ -859,6 +865,10 @@ void GPU::Start() {
|
|||
impl->Start();
|
||||
}
|
||||
|
||||
void GPU::NotifyShutdown() {
|
||||
impl->NotifyShutdown();
|
||||
}
|
||||
|
||||
void GPU::ObtainContext() {
|
||||
impl->ObtainContext();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue