I was just going to copy over some atomic code from my own library I use and use that to fix it, but if you guys want to do it then be my guest.


Quote Originally Posted by ZoriaRPG View Post
I'm not really sure how to make this an atomic operation that is respected in each of our various compilers, and on every architecture that we use. I think it would be different between gcc/MinGW, and MSVC, and possibly between different MSVC versions; plus it may be different from Windows to Liux and OSX (FreeBSD).

If any if you are clever-enough to know a solution, I'm all eyes. Is using std::atomic for the variable sufficient for our needs, or will that fail based on the compiler? I'm not sure at what point this was introduced as art of the cpp spec, to keep this cpp08 happy.

Which allegro file is this, BTW, so that I can post the problem on allegro.cc? ?
You can use intrinsics. std::atomic, like all of c++, is just bloated wrappers around c. Plus, allegro compiles as c code so simple is fine. For example, std::atomic::operator++ is the equivalent of:
_InterlockedIncrement(); on windows, or
__sync_add_and_fetch(). on gcc, etc.

Quote Originally Posted by DarkDragon View Post
Right. It's one of the many things that is a lot easier to do in C++11 than C++03. I'm pretty sure Allegro already has a mutex implementation somewhere, though.
Lies! Nothing in c++11 makes anything easier. Only sadness will you find.