Mark variable shared between threads as volatile.