Ways to Find a Race Condition

后端 未结 8 1128
无人共我
无人共我 2021-02-05 07:02

I have a bit of code with a race condition in it... I know that it is a race condition because it does not happen consistently, and it seems to happen more often on dual core ma

8条回答
  •  误落风尘
    2021-02-05 07:37

    I've had some luck with using Visual Studio's tracepoints to find race conditions. Of course it still affects the timing, but in the cases I used it, at least, it wasn't enough to completely prevent the race conditions from occurring. It seemed less disruptive than dedicated logging, at least.

    Other than that, try posting the code allowing others to look over it. Just studying the code in detail isn't a bad way to find race conditions.

提交回复
热议问题