One of the strategies I use is to simulate the rotation of threads - this is introducing spin expectations. The caveat is that you should not use standard wait mechanisms for your platform, because they are likely to create memory barriers. If the problem you are trying to fix is ββcaused by the lack of a memory barrier (because it is difficult to remove the barriers when using blocking strategies), then the standard wait mechanisms simply mask the problem. Instead, put an empty loop at the points where you want your code to stop for a moment. This may increase the likelihood of reproducing a concurrency error, but it is not a magic bullet.
source share