Is interlocked increment followed by comparison thread safe?

Sorry about the blog title, my imagination failed me :(. In our internal alias someone asked the question "Is the following thread safe" if(Interlocked.Increment(ref someInt) == CONSTANT_VAL) { doSomeStuff(); } My instant reaction was no because even though the increment is done in a thread safe way using System.Threading.Interlocked class, the comparison that follows is…

11