Skip to content

Commit

Permalink
Fix gcc compile error
Browse files Browse the repository at this point in the history
  • Loading branch information
stephen-webb committed Dec 19, 2024
1 parent 2d22ecb commit 86dad68
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/main/cpp/threadutility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <signal.h>
#include <mutex>
#include <list>
#include <condition_variable>

#ifdef _WIN32
#include <windows.h>
Expand Down Expand Up @@ -253,8 +254,8 @@ void ThreadUtility::addPeriodicTask(const LogString& name, std::function<void()>
std::lock_guard<std::mutex> lock(m_priv->job_mutex);
if (m_priv->maxDelay < delay)
m_priv->maxDelay = delay;
priv_data::TimePoint currentTime = std::chrono::system_clock::now();
m_priv->jobs.emplace_back(name, delay, currentTime + delay, 0, f);
auto currentTime = std::chrono::system_clock::now();
m_priv->jobs.push_back( priv_data::NamedPeriodicFunction{name, delay, currentTime + delay, 0, f} );
if (!m_priv->thread.joinable())
m_priv->thread = createThread(LOG4CXX_STR("log4cxx"), std::bind(&priv_data::doPeriodicTasks, m_priv.get()));
else
Expand Down
4 changes: 2 additions & 2 deletions src/main/include/log4cxx/private/writerappender_priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ struct WriterAppender::WriterAppenderPriv : public AppenderSkeleton::AppenderSke
immediateFlush(true),
writer(writer1)
#if LOG4CXX_EVENTS_AT_EXIT
, atExitRegistryRaii([this]{atExitActivated();})
, atExitRegistryRaii{ [this]{flush();} }
#endif
{
}
Expand All @@ -57,7 +57,7 @@ struct WriterAppender::WriterAppenderPriv : public AppenderSkeleton::AppenderSke
AppenderSkeletonPrivate(layout1),
immediateFlush(true)
#if LOG4CXX_EVENTS_AT_EXIT
, atExitRegistryRaii([this]{atExitActivated();})
, atExitRegistryRaii{ [this]{flush();} }
#endif
{
}
Expand Down

0 comments on commit 86dad68

Please sign in to comment.