named_thread: install atomic wait callback

This commit is contained in:
Nekotekina 2019-09-08 23:27:57 +03:00
parent 1668d6ee1b
commit faba366f89
2 changed files with 72 additions and 13 deletions

View file

@ -1667,11 +1667,14 @@ void thread_base::start(native_entry entry)
#endif
}
void thread_base::initialize()
void thread_base::initialize(bool(*wait_cb)(const void*))
{
// Initialize TLS variable
thread_ctrl::g_tls_this_thread = this;
// Initialize atomic wait callback
atomic_storage_futex::set_wait_callback(wait_cb);
g_tls_log_prefix = []
{
return thread_ctrl::g_tls_this_thread->m_name.get();
@ -1718,6 +1721,14 @@ void thread_base::initialize()
#endif
}
void thread_base::notify_abort() noexcept
{
// For now
notify();
atomic_storage_futex::raw_notify(+m_state_notifier);
}
bool thread_base::finalize(int) noexcept
{
// Report pending errors