#1091 is a sample code that could produce a data race. I had several attempts to fix it but cannot reach a satisfying result. Please have a look.