-
Notifications
You must be signed in to change notification settings - Fork 304
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HPCC-31981 Mutex code was inefficient #18756
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@richardkchapman looks good. Needs a bit of tidying up - commit message, squash and a few compile issues, but otherwise good to merge.
system/jlib/jmutex.hpp
Outdated
{ | ||
friend class Monitor; | ||
protected: | ||
Mutex(const char *name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OldMutex - otherwise you get windows compile errors.
system/jlib/jmutex.hpp
Outdated
@@ -46,8 +47,9 @@ extern jlib_decl void spinUntilReady(std::atomic_uint &value); | |||
#endif | |||
|
|||
#ifdef _WIN32 | |||
class jlib_decl Mutex | |||
class jlib_decl OldMutex |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Legacy might be a better name than old, but doesn't really matter.
system/jlib/jpqueue.hpp
Outdated
|
||
waiting--; | ||
return ret; | ||
} | ||
Mutex mutex; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trivial: newline before rather than after so that members are grouped together
system/jlib/jmutex.hpp
Outdated
private: | ||
T &mutex; | ||
public: | ||
MutexBlock<T>(T &m) : mutex(m) { mutex.lock(); }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the is not needed/correct on the constructor, and is causing compile errors for wasmembed
@ghalliday made changes as suggested, and squashed. Please re-review |
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]>
Type of change:
Checklist:
Smoketest:
Testing: