named_thread: install atomic wait callback

This commit is contained in:
Nekotekina committed 2019-09-10 18:48:46 +03:00
1 parent 1668d6ee1b
commit faba366f89
2 files changed
+72 -13

No files matched your search

+12 -1
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