Skip to content

Commit

Permalink
Don't require C++20 for usage (#258)
Browse files Browse the repository at this point in the history
  • Loading branch information
dg0yt authored Dec 31, 2024
1 parent 2f17e12 commit af4a8cd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions msh3.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,20 @@ template<typename T>
struct MsH3Waitable {
T Get() const { return State; }
void Set(T state) {
std::lock_guard Lock{Mutex};
std::lock_guard<std::mutex> Lock{Mutex};
State = state;
Event.notify_all();
}
T Wait() {
if (!State) {
std::unique_lock Lock{Mutex};
std::unique_lock<std::mutex> Lock{Mutex};
Event.wait(Lock, [&]{return State;});
}
return State;
}
bool WaitFor(uint32_t milliseconds TEST_DEF(250)) {
if (!State) {
std::unique_lock Lock{Mutex};
std::unique_lock<std::mutex> Lock{Mutex};
return Event.wait_for(Lock, milliseconds*1ms, [&]{return State;});
}
return true;
Expand Down

0 comments on commit af4a8cd

Please sign in to comment.