ooc  1.3c
Object Oriented tollkit fo ANSI C
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
multi_thread.dox File Reference

Multithreading support. More...

Macros

#define TLS
 Thread Local Storage. More...
 
#define ooc_Mutex
 Mutex. Allocates a mutex. More...
 
#define ooc_mutex_init(x)
 Initializes the mutex. More...
 
#define ooc_mutex_release(x)
 Releases the mutex. More...
 
#define ooc_lock(x)
 Locks the mutex. More...
 
#define ooc_unlock(x)
 Unlocks the mutex. More...
 
#define ooc_try_lock(x)
 Tries to lock the mutex. More...
 

Detailed Description

Multithreading support.

Multithreading primitives that can be used writing ooc core and ooc extensions (e.g. new containers, etc.) Don't use these in your own code! Use the platform native threading or some generalized one (e.g. OpenMP) instead.

Macro Definition Documentation

#define ooc_lock (   x)

Locks the mutex.

Mutex must be initialized already!

Parameters
xThe mutex to be locked.
Warning
Nested lock is not allowed!
#define ooc_Mutex

Mutex. Allocates a mutex.

Threading primitive definitions.

#define ooc_mutex_init (   x)

Initializes the mutex.

Mutexes must be initialized before use.

Parameters
xThe mutex to be initialized.
#define ooc_mutex_release (   x)

Releases the mutex.

Mutexes must be released after use.
Releasing a mutex locked by an other thread is an error, the behavior is implementation dependent.

Parameters
xThe mutex to be released.
#define ooc_try_lock (   x)

Tries to lock the mutex.

Mutex must be initialized already!

Parameters
xThe mutex to be locked.
Returns
TRUE is the mutex could be locked by the thread, FALSE otherwise.
Warning
Nested lock is not allowed!
#define ooc_unlock (   x)

Unlocks the mutex.

Mutex must be initialized already and must be locked by the thread!

Parameters
xThe mutex to be unlocked.
Warning
Nested lock is not allowed!
#define TLS

Thread Local Storage.

Must be defined as a static or global variable. This is a type qualifier, binds left to right.

TLS int MyVariable;