ui:loop_gtk: Use default thread::id constructor instead of explicit id

This commit is contained in:
Doug Johnson 2017-07-09 22:10:08 -06:00
parent b65c7e6297
commit ae30bc1207
1 changed files with 3 additions and 3 deletions

View File

@ -26,7 +26,7 @@ class PostedFn {
std::unique_ptr<Loop> Loop::Create() { return std::make_unique<GTKLoop>(); } std::unique_ptr<Loop> Loop::Create() { return std::make_unique<GTKLoop>(); }
GTKLoop::GTKLoop() : thread_id_(0) { GTKLoop::GTKLoop() : thread_id_() {
gtk_init(nullptr, nullptr); gtk_init(nullptr, nullptr);
xe::threading::Fence init_fence; xe::threading::Fence init_fence;
thread_ = std::thread([&init_fence, this]() { thread_ = std::thread([&init_fence, this]() {
@ -65,7 +65,7 @@ gboolean _posted_fn_thunk(gpointer posted_fn) {
} }
void GTKLoop::Post(std::function<void()> fn) { void GTKLoop::Post(std::function<void()> fn) {
assert_true(thread_id_ != std::thread::id(0)); assert_true(thread_id_ != std::thread::id());
gdk_threads_add_idle(_posted_fn_thunk, gdk_threads_add_idle(_posted_fn_thunk,
reinterpret_cast<gpointer>(new PostedFn(std::move(fn)))); reinterpret_cast<gpointer>(new PostedFn(std::move(fn))));
} }
@ -77,7 +77,7 @@ void GTKLoop::PostDelayed(std::function<void()> fn, uint64_t delay_millis) {
} }
void GTKLoop::Quit() { void GTKLoop::Quit() {
assert_true(thread_id_ != std::thread::id(0)); assert_true(thread_id_ != std::thread::id());
} }