The first patch is a stress test which will hang without the subsequent patch.
This patch covers all Allegro versions. The code was incorrect all along, but symptoms only appeared with real SMP.
Thanks to Franz support for recommending the solution.
The stress test may also fail intermittently for unrelated reasons. Franz is aware of this problem (which stems from the weak-keys hash in impl-allegro.lisp).