A set of macros to access multi-threaded functionality. The Speect Engine itself is not multi-threaded, but it does need access to mutex locks to be thread safe, and thread id’s for logging purposes. Different multi-threaded implementations are supported by implementing the macros.
S_DECLARE_MUTEX | Declare a s_mutex. |
S_DECLARE_MUTEX_STATIC | Declare a static s_mutex. |
s_mutex_init | Initialize a mutex. |
s_mutex_destroy | Destroy a mutex. |
s_mutex_lock | Lock a mutex. |
s_mutex_unlock | Unlock a mutex. |
s_thread_id | Get the calling thread id. |
Definition of a opaque mutex structure.
Lock a mutex.
Locks the given s_mutex mutex so that it can only be accessed by one thread.
Parameters: |
|
---|
Unlock a mutex.
Unlocks the given s_mutex mutex that has previously been locked by s_mutex_lock, so that it is accessible to all threads.
Parameters: |
|
---|
Get the calling thread id.
Return: | The calling thread id as an unsigned long. |
---|