The Windows NT operating system has the EnterCriticalSection and ExitCriticalSection objects to allow for synchronization between threads.

What is the Linux equivalent, while using the GCC compiler?

I see references around to __sync_synchronize along with __scoped_lock

In fact I see mention of a number of atomic __sync functions along with a number of __atomic ones.

I actually have been using __sync_fetch_and_add for my atomic increment Should I be using __atomic_add_dispatch instead?
What's the difference?

Which ones should I be using? Are there some constructs in C++ that I can use in both the latest version of GCC and Visual C++ 2010 that are available as I'm going to be writing some cross platform code.

I see boost has some functions available, but for various reasons I'm not allowed to use boost under windows.

Edit
Report