Add clarifying comment to EventEmitter::emit() snapshot behavior

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Bryan Helmkamp 2026-03-21 13:14:48 -04:00
parent e2f884df23
commit b22862d04c

View file

@ -1062,6 +1062,7 @@ impl EventEmitter {
event.trace();
// Clone the listener list so we don't hold the lock during dispatch.
// This prevents deadlocks if a listener calls emit() reentrantly.
// Note: listeners added during this emit() won't receive the current event.
let snapshot: Vec<EventListener> = self
.listeners
.lock()