Unique ID with ::InterlockedIncrement (VC++)
Using VC++, to get a unique ID that counts upwards, I was wondering whether this is legal in a multi-threaded application?

    uint32_t GetNewId() { return ::InterlockedIncrement(&lastId); }

Basically, I am wondering whether InterlockedIncrement just protects the increment, or whether the return value is also guarded against race conditions?
Unique ID with ::InterlockedIncrement (VC++)
===

Using VC++, to get a unique ID that counts upwards, I was wondering whether this is legal in a multi-threaded application?

    uint32_t GetNewId() { return ::InterlockedIncrement(&lastId); }

Basically, I am wondering whether InterlockedIncrement just protects the increment, or whether the return value is also guarded against race conditions?