multithreading - Fencing in old C++ compilers -


i have multithreaded application need compile on gcc 4.4, not allowed use c++0x flag.

i want variable behave atomically unfortunately w/o c++0x flag unable use atomic<t> in c++.

i tried boost::atomic gives me error saying

iso c++ forbids declaration of "atomic" no type

is there other way achieve atomicity under these conditions, can use fencing - if yes there guide or commonly used commands achieve fencing in old c++.

as advised sam varshavchik in comments above, using posix std::mutex can protect variable in multithreaded application.

std::mutex overkill it's best have gcc 4.4.

c++11 atomic better job @ solving issue available on more recent compilers.


Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo