Fix a possible dead lock when quiting.
It could happen that we are quitting when the embed thread is still waiting for the main thread, so we make sure embed thread is always signaled when quitting.
This commit is contained in:
parent
01dd5638d0
commit
d5ffa4dc77
1 changed files with 7 additions and 1 deletions
|
@ -39,10 +39,16 @@ NodeBindings::NodeBindings(bool is_browser)
|
||||||
}
|
}
|
||||||
|
|
||||||
NodeBindings::~NodeBindings() {
|
NodeBindings::~NodeBindings() {
|
||||||
// Clear uv.
|
// Quit the embed thread.
|
||||||
embed_closed_ = true;
|
embed_closed_ = true;
|
||||||
|
uv_sem_post(&embed_sem_);
|
||||||
WakeupEmbedThread();
|
WakeupEmbedThread();
|
||||||
|
|
||||||
|
// Wait for everything to be done.
|
||||||
uv_thread_join(&embed_thread_);
|
uv_thread_join(&embed_thread_);
|
||||||
|
message_loop_->RunUntilIdle();
|
||||||
|
|
||||||
|
// Clear uv.
|
||||||
uv_sem_destroy(&embed_sem_);
|
uv_sem_destroy(&embed_sem_);
|
||||||
uv_timer_stop(&idle_timer_);
|
uv_timer_stop(&idle_timer_);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue