Open requested to merge alex-ozdemir/coquille:messages-lock into master
On my machine doing a step-to-cursor frequently caused a deadlock. In particular, any >10 command step almost always caused a deadlock. The root cause was using locks to lock (large blocks of) code, rather than data.
Previously the messenger class had a single lock used for various things. Now it has two locks, one for the message queue and another for the interrupt flags. The messages lock is only grabbed for brief periods, when manipulating the queue. This fixes the deadlock on my machine.