If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

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.

Originally Posted by ZoriaRPG

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.

Originally Posted by DarkDragon

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.

Join the Gleeok Book Club - It's easy, all you have to do is read...

"Protocols of the Learned Elders of Zion" (British Royal Institute, 1906)
None Dare Call It Conspiracy -Gary Allen
Deliberate Dumbing Down of America -Charlotte Iserbyt
Morals and Dogma -Albert Pike
Bloodlines Of The Illuminati -Fritz Springmeier
The Rape Of Justice -Eustace Mullins
The World Order, A Study in the Hegemony of Parasitism -Eustace Mullins
The Most Dangerous Superstition -Larken Rose"War is a Racket" �Major General Smedley Butler

�The modern theory of the perpetuation of debt has drenched the earth with blood, and crushed its inhabitants under burdens ever accumulating.� �Thomas Jefferson�It is well enough that the people of the nation do not understand our banking and monetary system for, if they did, I believe there would be a revolution before tomorrow morning.� �Henry Ford�Man will ultimately be governed by God or by tyrants.� �Benjamin Franklin

This post contains the official Gleeok� seal of approval. Look for these and other posts in an area near you.

Okay, challenge accepted. Please post C or C++03 code that performs an atomic increment correctly on every single standard-compliant C++03 compiler on every computer architecture in the world. I will do the same for C++11

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.

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.

Lies! Nothing in c++11 makes anything easier. Only sadness will you find.

Ill take your fix for now, thanks. I don't want to delve into the murky waters of this more than needed. If it turns out to need more, than it needs more, but let's try the simple fix, first.

I will also further try to convince the allegro blokes to incorporate it, or take it and expand if if they so desire. One genius telling me that we should not care about threads and that allegro was not designed to be thread-safe on 1980s architecture, is just an example of pure madness.

If for some reason it does not work on one compiler or another, we can add in compiler definitions. Yay.
@jman2050
Still has an allegro.cc account, and he is the one who posted the original ZC project listing there. I posted an updated listing, and I will add to it as time permits. There is some weird issue with their FTP upload, which claims to support 100MB files, but it is failing me. (I', trying to add the stable Linux build, which is 43MB in size.)

Butting heads where? We're bantering about C++11 but switching the whole Allegro project from C to C++11 was obviously not a serious suggestion (and there's a 0% chance the Allegro folks would accept a pull request that tries to do so).

I'm trying to give you practical advice about how to proceed in the way least likely to waste your time, based on my observations about how the Allegro folks run their ship. Obviously feel free to check with Edgar directly if you believe I am wrong.

Fun fact: Mutexes is not multi-threading. Mutex locks are the opposite of multi-threading! Bicker!!!

Originally Posted by DarkDragon

Okay, challenge accepted. Please post C or C++03 code that performs an atomic increment correctly on every single standard-compliant C++03 compiler on every computer architecture in the world. I will do the same for C++11

Bicker bicker bicker!!! Are you saying that c++11 is more widely supported than c? Bicker? Stuff, bicker. Nonsense! Bicker!!

[edit] Keep in mind that the allegro.cc folks like to argue about anything and everything. At least that's what happened every time I used to stop by there.

Join the Gleeok Book Club - It's easy, all you have to do is read...

"Protocols of the Learned Elders of Zion" (British Royal Institute, 1906)
None Dare Call It Conspiracy -Gary Allen
Deliberate Dumbing Down of America -Charlotte Iserbyt
Morals and Dogma -Albert Pike
Bloodlines Of The Illuminati -Fritz Springmeier
The Rape Of Justice -Eustace Mullins
The World Order, A Study in the Hegemony of Parasitism -Eustace Mullins
The Most Dangerous Superstition -Larken Rose"War is a Racket" �Major General Smedley Butler

�The modern theory of the perpetuation of debt has drenched the earth with blood, and crushed its inhabitants under burdens ever accumulating.� �Thomas Jefferson�It is well enough that the people of the nation do not understand our banking and monetary system for, if they did, I believe there would be a revolution before tomorrow morning.� �Henry Ford�Man will ultimately be governed by God or by tyrants.� �Benjamin Franklin

This post contains the official Gleeok� seal of approval. Look for these and other posts in an area near you.