MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / waitWithTimeout

Method waitWithTimeout

source/util/synchronization.cpp:119–141  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

117}
118
119void BoxedWineCondition::waitWithTimeout(std::unique_lock<std::mutex>& lock, U32 ms) {
120 KThread* thread = KThread::currentThread();
121 if (thread) {
122 thread->waitingCond = shared_from_this();
123 }
124 this->c.wait_for(lock, std::chrono::milliseconds(KSystem::emulatedMilliesToHost(ms)));
125 if (thread) {
126 thread->waitingCond = nullptr;
127 }
128 if (parentCount) {
129 for (int i = 0; i < MAX_PARENTS; i++) {
130 std::shared_ptr<BoxedWineCondition> parent;
131 {
132 const std::lock_guard<std::mutex> lock(parentsMutex);
133 parent = parents[i].lock();
134 }
135 if (parent) {
136 BOXEDWINE_CRITICAL_SECTION_WITH_CONDITION(parent);
137 parent->signalAll();
138 }
139 }
140 }
141}
142
143void BoxedWineCondition::unlock() {
144 this->lockOwner = 0;

Callers

nothing calls this directly

Calls 5

addTimerFunction · 0.85
signalAllMethod · 0.80
addToBackMethod · 0.80
unscheduleThreadFunction · 0.50
lockMethod · 0.45

Tested by

no test coverage detected