Skip to content

Commit

Permalink
HPCC-31981 Mutex code was inefficient
Browse files Browse the repository at this point in the history
Refactor Mutex class to use modern C++ standard mutexes,
which are significantly faster. Leave old Mutex class in place just
in case the unlockall functionality is significant in the one place
that uses it.

Also fixes Incorrect summary stats fromjlib timing test

Signed-off-by: Richard Chapman <[email protected]>
  • Loading branch information
richardkchapman committed Jun 19, 2024
1 parent 88fa27e commit 501ef6d
Show file tree
Hide file tree
Showing 12 changed files with 129 additions and 354 deletions.
4 changes: 2 additions & 2 deletions deployment/deploy/DeployTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ class CDeployTask : public CInterface, implements IDeployTask
// Prompt to retry on error
m_errorString.appendf("Cannot copy %s to %s: ", source, target);

synchronized block(s_monitor);
MonitorBlock block(s_monitor);
if (m_pCallback->getAbortStatus())//has some other thread set the global abort flag?
break; //go back to beginning of loop where we exit on abort

Expand Down Expand Up @@ -822,7 +822,7 @@ class CDeployTask : public CInterface, implements IDeployTask

if (m_msgBoxOwner)//did this thread show the message box in last iteration of this loop?
{
synchronized block(s_monitor);
MonitorBlock block(s_monitor);
s_msgBoxActive = false;
m_msgBoxOwner = false;//up for grabs by other threads
s_monitor.notifyAll();
Expand Down
279 changes: 0 additions & 279 deletions esp/esplib/pqueue.hpp

This file was deleted.

2 changes: 1 addition & 1 deletion system/jlib/jlog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1437,7 +1437,7 @@ bool CLogMsgManager::MsgProcessor::flush(unsigned timeout)
return false;
try
{
synchronized block(pullCycleMutex, timeout+start-now);
TimedMutexBlock block(pullCycleMutex, timeout+start-now);
}
catch(IException * e)
{
Expand Down
2 changes: 1 addition & 1 deletion system/jlib/jlog.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,7 @@ private:
CallbackInterThreadQueueOf<LogMsg, MsgProcessor, false> q;
unsigned droppingLimit;
unsigned numToDrop = 1;
Mutex pullCycleMutex;
TimedMutex pullCycleMutex;
};
Owned<MsgProcessor> processor;

Expand Down
Loading

0 comments on commit 501ef6d

Please sign in to comment.