Skip to content

Commit

Permalink
adapt fix for race condition in arbiter
Browse files Browse the repository at this point in the history
  • Loading branch information
hobu committed Jun 6, 2024
1 parent 8300db9 commit 6876e7a
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions entwine/third/arbiter/arbiter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -353,16 +353,13 @@ std::shared_ptr<Driver> Arbiter::getDriver(const std::string path) const
{
const auto type(getProtocol(path));

{
std::lock_guard<std::mutex> lock(m_mutex);
auto it = m_drivers.find(type);
if (it != m_drivers.end()) return it->second;
}
std::lock_guard<std::mutex> lock(m_mutex);
auto it = m_drivers.find(type);
if (it != m_drivers.end()) return it->second;

const json config = getConfig(m_config);
if (auto driver = Driver::create(*m_pool, type, config.dump()))
{
std::lock_guard<std::mutex> lock(m_mutex);
m_drivers[type] = driver;
return driver;
}
Expand Down

0 comments on commit 6876e7a

Please sign in to comment.