@@ -28,6 +28,7 @@ struct LiveThreaded::Impl {
2828 }
2929
3030 ILogReceiver* log_receiver;
31+ std::atomic<std::thread::id> thread_id_{};
3132 // Set to false when destructor is called
3233 std::atomic<bool > keep_going{true };
3334 KeepGoing last_cb_ret{KeepGoing::Continue};
@@ -114,7 +115,7 @@ void LiveThreaded::Start(MetadataCallback metadata_callback,
114115 RecordCallback record_callback,
115116 ExceptionCallback exception_callback) {
116117 // Deadlock check
117- if (std::this_thread::get_id () == thread_. Id () ) {
118+ if (std::this_thread::get_id () == impl_-> thread_id_ ) {
118119 std::ostringstream log_ss;
119120 log_ss << " [LiveThreaded::Start] Called Start from callback thread, which "
120121 " would cause a deadlock. Ignoring." ;
@@ -161,6 +162,7 @@ void LiveThreaded::ProcessingThread(Impl* impl,
161162 static constexpr auto kMethodName = " LiveThreaded::ProcessingThread" ;
162163 constexpr std::chrono::milliseconds kTimeout {50 };
163164
165+ impl->thread_id_ = std::this_thread::get_id ();
164166 const auto metadata_cb{std::move (metadata_callback)};
165167 const auto record_cb{std::move (record_callback)};
166168 const auto exception_cb{std::move (exception_callback)};
0 commit comments