Skip to content

Commit 6876e7a

Browse files
committed
adapt fix for race condition in arbiter
1 parent 8300db9 commit 6876e7a

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

entwine/third/arbiter/arbiter.cpp

+3-6
Original file line numberDiff line numberDiff line change
@@ -353,16 +353,13 @@ std::shared_ptr<Driver> Arbiter::getDriver(const std::string path) const
353353
{
354354
const auto type(getProtocol(path));
355355

356-
{
357-
std::lock_guard<std::mutex> lock(m_mutex);
358-
auto it = m_drivers.find(type);
359-
if (it != m_drivers.end()) return it->second;
360-
}
356+
std::lock_guard<std::mutex> lock(m_mutex);
357+
auto it = m_drivers.find(type);
358+
if (it != m_drivers.end()) return it->second;
361359

362360
const json config = getConfig(m_config);
363361
if (auto driver = Driver::create(*m_pool, type, config.dump()))
364362
{
365-
std::lock_guard<std::mutex> lock(m_mutex);
366363
m_drivers[type] = driver;
367364
return driver;
368365
}

0 commit comments

Comments
 (0)