Fix error

This commit is contained in:
Alexey Milovidov 2022-08-06 20:46:42 +02:00 committed by vdimir
parent f554ff9d99
commit f15623141e
No known key found for this signature in database
GPG Key ID: 6EE4CE2BEDC51862

View File

@ -104,16 +104,25 @@ public:
class ScopedAttach : private boost::noncopyable
{
private:
bool attached = false;
public:
explicit ScopedAttach(const ThreadGroupStatusPtr & thread_group)
{
CurrentThread::attachTo(thread_group);
if (!CurrentThread::getGroup())
{
CurrentThread::attachToIfDetached(thread_group);
attached = true;
}
}
~ScopedAttach()
{
if (attached)
{
CurrentThread::detachQuery();
}
}
};
private: