The input thread held inputlock while sending, and the send functions take
peerlock, the reverse of the emulator thread's peerlock -> inputlock (via
send*Message). The event thread held eventlock while queueing callbacks,
which takes adhocEvtMtx, closing a cycle with the input thread
(peerlock -> eventlock in spawnLocalEvent) and __NetMatchingCallbacks
(adhocEvtMtx -> peerlock).
Detach messages under the lock and handle them after unlocking. The order
is unchanged: the event thread still pops one message at a time, and the
input thread still sends the whole stack as a batch, with anything linked
meanwhile left for the next pass (rather than overwritten, as a message
linked from within a send was before). The two copies of the input send
chain become sendInputMessages().
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>