'volatile' doesn't make variable thread safe. you should synchronise threads even for ++ and -- operations