Skip to content

Commit

Permalink
Synchonization should not depend on APR threads
Browse files Browse the repository at this point in the history
  • Loading branch information
stephen-webb committed Nov 19, 2023
1 parent d24a515 commit d27c2b2
Showing 1 changed file with 0 additions and 10 deletions.
10 changes: 0 additions & 10 deletions src/main/cpp/aprinitializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,7 @@ APRInitializer::~APRInitializer()

void APRInitializer::stopWatchDogs()
{
#if APR_HAS_THREADS
std::unique_lock<std::mutex> lock(m_priv->mutex);
#endif

while (!m_priv->watchdogs.empty())
{
Expand Down Expand Up @@ -153,18 +151,14 @@ apr_threadkey_t* APRInitializer::getTlsKey()
void APRInitializer::registerCleanup(FileWatchdog* watchdog)
{
APRInitializer& instance(getInstance());
#if APR_HAS_THREADS
std::unique_lock<std::mutex> lock(instance.m_priv->mutex);
#endif
instance.m_priv->watchdogs.push_back(watchdog);
}

void APRInitializer::unregisterCleanup(FileWatchdog* watchdog)
{
APRInitializer& instance(getInstance());
#if APR_HAS_THREADS
std::unique_lock<std::mutex> lock(instance.m_priv->mutex);
#endif

for (std::list<FileWatchdog*>::iterator iter = instance.m_priv->watchdogs.begin();
iter != instance.m_priv->watchdogs.end();
Expand All @@ -180,17 +174,13 @@ void APRInitializer::unregisterCleanup(FileWatchdog* watchdog)

void APRInitializer::addObject(size_t key, const ObjectPtr& pObject)
{
#if APR_HAS_THREADS
std::unique_lock<std::mutex> lock(m_priv->mutex);
#endif
m_priv->objects[key] = pObject;
}

const ObjectPtr& APRInitializer::findOrAddObject(size_t key, std::function<ObjectPtr()> creator)
{
#if APR_HAS_THREADS
std::unique_lock<std::mutex> lock(m_priv->mutex);
#endif
auto pItem = m_priv->objects.find(key);
if (m_priv->objects.end() == pItem)
pItem = m_priv->objects.emplace(key, creator()).first;
Expand Down

0 comments on commit d27c2b2

Please sign in to comment.