Use TGuard<TMutex> to acquire lock
@@ -133,9 +133,10 @@ public:
if (IsSyncDirSet() && !LockPort(port))
continue;
- Lock.Acquire();
+ {
+ TGuard<TMutex> g(Lock);
Sockets.push_back(std::move(sock));
- Lock.Release();
+ }
return port;
}
ythrow yexception() << "Failed to find port";
