MCPcopy Create free account
hub / github.com/WasmEdge/WasmEdge / notifyAllWaiters

Method notifyAllWaiters

include/runtime/instance/memory.h:394–405  ·  view source on GitHub ↗

Wake all waiters on this memory instance (used by Executor::stop()).

Source from the content-addressed store, hash-verified

392
393 /// Wake all waiters on this memory instance (used by Executor::stop()).
394 void notifyAllWaiters() noexcept {
395 std::unique_lock<std::mutex> Locker(WaiterMapMutex);
396 for (auto &[Addr, W] : WaiterMap) {
397 // Lock the Waiter mutex and notify while holding it. This pairs with
398 // the wait loop which checks StopToken under this same mutex before
399 // entering Cond.wait(). The lock ensures we either:
400 // (a) block until the waiter enters Cond.wait() — then wake it, or
401 // (b) run before the waiter checks StopToken — it will see it set.
402 std::unique_lock<std::mutex> WaiterLocker(W.Mutex);
403 W.Cond.notify_all();
404 }
405 }
406
407private:
408 /// \name Data of memory instance.

Callers 1

atomicNotifyAllMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected