STXXL  1.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Synchronization Primitives for Multi-Threading

To support multi-threading, some parts of STXXL use synchronization primitives to ensure correct results. The primitives are based either on pthreads or on Boost classes.

Mutexes

For simple mutual exclusion contexts, stxxl::mutex objects should be used together with scoped locks:

class Something
{
stxxl::mutex m_mtx;
void critical_function()
{
// do something requiring locking
}
};

Semaphores

Additionally stxxl::semaphore is available if counting is required.

Further Primitives: State and OnOff-Switch

stxxl::state is a synchronized state switching mechanism?

stxxl::onoff_switch is a two state semaphore thing?