notifyAll method
void
notifyAll()
Wake up all currently waiting tasks (does not store permits).
Immediately wakes all tasks currently waiting on notified. Unlike notifyOne, this does not store permits for future waiters.
Use cases:
- Broadcast shutdown signal
- Configuration reload for all workers
- "Check your state" broadcast
Example: {@tool snippet example/notify_notify_all.dart} {@end-tool}
Implementation
void notifyAll() {
if (_closed) return;
_epoch++;
while (_waiters.isNotEmpty) {
final c = _waiters.removeLast();
if (!c.isCompleted) c.complete();
}
}