compare_exchange_weak can fail spuriously (ie, even if the values match) on some platforms (in my case arm musl). This leads to a panic as we are assuming that x is not null, but in fact it can be null in the spurious failure case. We can wrap this in a loop and check for this, or we can just use the strong variant as I have here, and let llvm do the loop for us.
compare_exchange_weak can fail spuriously (ie, even if the values match) on some platforms (in my case arm musl). This leads to a panic as we are assuming that x is not null, but in fact it can be null in the spurious failure case. We can wrap this in a loop and check for this, or we can just use the strong variant as I have here, and let llvm do the loop for us.