forked from Kistler-Group/sdbus-cpp
Make resetting loop thread ID exception-safe
This commit is contained in:
@ -92,6 +92,7 @@ std::string Connection::getUniqueName() const
|
|||||||
void Connection::enterEventLoop()
|
void Connection::enterEventLoop()
|
||||||
{
|
{
|
||||||
loopThreadId_ = std::this_thread::get_id();
|
loopThreadId_ = std::this_thread::get_id();
|
||||||
|
SCOPE_EXIT{ loopThreadId_ = std::thread::id{}; };
|
||||||
|
|
||||||
std::lock_guard guard(loopMutex_);
|
std::lock_guard guard(loopMutex_);
|
||||||
|
|
||||||
@ -105,8 +106,6 @@ void Connection::enterEventLoop()
|
|||||||
if (!success)
|
if (!success)
|
||||||
break; // Exit I/O event loop
|
break; // Exit I/O event loop
|
||||||
}
|
}
|
||||||
|
|
||||||
loopThreadId_ = std::thread::id{};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Connection::enterEventLoopAsync()
|
void Connection::enterEventLoopAsync()
|
||||||
|
Reference in New Issue
Block a user