> Isn't this supposed to give me some sort of race condition? Thanks.
It can give you some sort of race condition. (depends on: is increment of an int atomic on the particular implementation?)
Most compilers will replace the loop with n += 50000, and because creation of a thread takes much longer than incrementing an integer, there may be no race condition.
n++ is one processor instruction if you do not using return value. It is probably just optimized your code (loop elimination to n+=50000) and separated all access to n.
Try