Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions source/common/thread_local/thread_local_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ void InstanceImpl::registerThread(Event::Dispatcher& dispatcher, bool main_threa

if (main_thread) {
main_thread_dispatcher_ = &dispatcher;
thread_local_data_.dispatcher_ = &dispatcher;
} else {
ASSERT(!containsReference(registered_threads_, dispatcher));
registered_threads_.push_back(dispatcher);
dispatcher.post([&dispatcher] { thread_local_data_.dispatcher_ = &dispatcher; });
}

dispatcher.post([&dispatcher] { thread_local_data_.dispatcher_ = &dispatcher; });
}

void InstanceImpl::removeSlot(SlotImpl& slot) {
Expand Down
2 changes: 1 addition & 1 deletion test/common/thread_local/thread_local_impl_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ class TestThreadLocalObject : public ThreadLocalObject {
class ThreadLocalInstanceImplTest : public testing::Test {
public:
ThreadLocalInstanceImplTest() {
EXPECT_CALL(main_dispatcher_, post(_));
tls_.registerThread(main_dispatcher_, true);
EXPECT_EQ(&main_dispatcher_, &tls_.dispatcher());
EXPECT_CALL(thread_dispatcher_, post(_));
tls_.registerThread(thread_dispatcher_, false);
}
Expand Down