Mutex
is not thread-safe on ARM processors
#13642
Labels
kind:bug
A bug in the code. Does not apply to documentation, specs, etc.
platform:arm
status:duplicate
topic:multithreading
topic:stdlib:concurrency
The following code generates a 1M-element array across multiple fibers and then prints its size, so the output should be
1000000
:On Intel processors on both macOS and Linux, it gives the correct output reliably. On ARM processors on both macOS and Linux, it comes up anywhere from a few dozen to a few thousand short.
If I use
Crystal::SpinLock#sync
instead ofMutex#synchronize
it displays the correct output, so it seems it's something in betweenMutex
andSpinLock
. This is good news because it means thatChannel
should still be thread-safe on ARM since it usesSpinLock
directly.The text was updated successfully, but these errors were encountered: