Quick question here. I haven't used atomic operations before and Windows API seems to lack a fitting atomic API...

The problem is, as usual, multi-threading.
There is a dialog that is manipulated endlessly by two threads, which is a very, very bad thing even with synchronization. So right now, I'm thinking of modifying variables in the class with atomic operations to signal the GUI thread.
Incrementing, decrementing, assigning and all that seems to be no problem, but comparing them is worse. There's no such function (or easy one) in Window's API Arsenal.

Code:
int myvar;
myvar++;
if (myvar != oldvar) mydialog->setsomething(myvar);
This is essentially what I'm trying to do.
Tips would be appreciated.