Main Page   Modules   Data Structures   File List   Data Fields   Related Pages  

Thread functions
[D-BUS message system public API]

dbus_threads_init(), dbus_mutex_lock(), etc. More...

Functions

DBusMutex * dbus_mutex_new (void)
 Creates a new mutex using the function supplied to dbus_threads_init(), or creates a no-op mutex if threads are not initialized. More...

void dbus_mutex_free (DBusMutex *mutex)
 Frees a mutex created with dbus_mutex_new(); does nothing if passed a NULL pointer.

dbus_bool_t dbus_mutex_lock (DBusMutex *mutex)
 Locks a mutex. More...

dbus_bool_t dbus_mutex_unlock (DBusMutex *mutex)
 Unlocks a mutex. More...

DBusCondVar * dbus_condvar_new (void)
 Creates a new condition variable using the function supplied to dbus_threads_init(), or creates a no-op condition variable if threads are not initialized. More...

void dbus_condvar_free (DBusCondVar *cond)
 Frees a conditional variable created with dbus_condvar_new(); does nothing if passed a NULL pointer.

void dbus_condvar_wait (DBusCondVar *cond, DBusMutex *mutex)
 Atomically unlocks the mutex and waits for the conditions variable to be signalled. More...

dbus_bool_t dbus_condvar_wait_timeout (DBusCondVar *cond, DBusMutex *mutex, int timeout_milliseconds)
 Atomically unlocks the mutex and waits for the conditions variable to be signalled, or for a timeout. More...

void dbus_condvar_wake_one (DBusCondVar *cond)
 If there are threads waiting on the condition variable, wake up exactly one. More...

void dbus_condvar_wake_all (DBusCondVar *cond)
 If there are threads waiting on the condition variable, wake up all of them. More...

dbus_bool_t dbus_threads_init (const DBusThreadFunctions *functions)
 Initializes threads. More...


Detailed Description

dbus_threads_init(), dbus_mutex_lock(), etc.

Functions and macros related to threads and thread locks.


Function Documentation

DBusCondVar* dbus_condvar_new void   
 

Creates a new condition variable using the function supplied to dbus_threads_init(), or creates a no-op condition variable if threads are not initialized.

May return NULL even if threads are initialized, indicating out-of-memory.

Returns:
new mutex or NULL

Definition at line 119 of file dbus-threads.c.

References DBusThreadFunctions::condvar_new.

void dbus_condvar_wait DBusCondVar *    cond,
DBusMutex *    mutex
 

Atomically unlocks the mutex and waits for the conditions variable to be signalled.

Locks the mutex again before returning. Does nothing if passed a NULL pointer.

Definition at line 145 of file dbus-threads.c.

References DBusThreadFunctions::condvar_wait.

dbus_bool_t dbus_condvar_wait_timeout DBusCondVar *    cond,
DBusMutex *    mutex,
int    timeout_milliseconds
 

Atomically unlocks the mutex and waits for the conditions variable to be signalled, or for a timeout.

Locks the mutex again before returning. Does nothing if passed a NULL pointer.

Parameters:
cond  the condition variable
mutex  the mutex
timeout_milliseconds  the maximum time to wait
Returns:
TRUE if the condition was reached, or FALSE if the timeout was reached.

Definition at line 165 of file dbus-threads.c.

References DBusThreadFunctions::condvar_wait, and DBusThreadFunctions::condvar_wait_timeout.

void dbus_condvar_wake_all DBusCondVar *    cond
 

If there are threads waiting on the condition variable, wake up all of them.

Does nothing if passed a NULL pointer.

Definition at line 193 of file dbus-threads.c.

References DBusThreadFunctions::condvar_wake_all.

void dbus_condvar_wake_one DBusCondVar *    cond
 

If there are threads waiting on the condition variable, wake up exactly one.

Does nothing if passed a NULL pointer.

Definition at line 181 of file dbus-threads.c.

References DBusThreadFunctions::condvar_wake_one.

dbus_bool_t dbus_mutex_lock DBusMutex *    mutex
 

Locks a mutex.

Does nothing if passed a NULL pointer. Locks are not recursive.

Returns:
TRUE on success

Definition at line 88 of file dbus-threads.c.

References DBusThreadFunctions::mutex_lock.

DBusMutex* dbus_mutex_new void   
 

Creates a new mutex using the function supplied to dbus_threads_init(), or creates a no-op mutex if threads are not initialized.

May return NULL even if threads are initialized, indicating out-of-memory.

Returns:
new mutex or NULL

Definition at line 62 of file dbus-threads.c.

References DBusThreadFunctions::mutex_new.

dbus_bool_t dbus_mutex_unlock DBusMutex *    mutex
 

Unlocks a mutex.

Does nothing if passed a NULL pointer.

Returns:
TRUE on success

Definition at line 102 of file dbus-threads.c.

References DBusThreadFunctions::mutex_unlock.

dbus_bool_t dbus_threads_init const DBusThreadFunctions   functions
 

Initializes threads.

If this function is not called, the D-BUS library will not lock any data structures. If it is called, D-BUS will do locking, at some cost in efficiency. Note that this function must be called BEFORE using any other D-BUS functions.

This function may be called more than once, as long as you pass in the same functions each time. If it's called multiple times with different functions, then a warning is printed, because someone is confused.

Parameters:
functions  functions for using threads
Returns:
TRUE on success, FALSE if no memory

Definition at line 291 of file dbus-threads.c.

References DBusThreadFunctions::condvar_free, DBusThreadFunctions::condvar_new, DBusThreadFunctions::condvar_wait, DBusThreadFunctions::condvar_wait_timeout, DBusThreadFunctions::condvar_wake_all, DBusThreadFunctions::condvar_wake_one, DBusThreadFunctions::mask, DBusThreadFunctions::mutex_free, DBusThreadFunctions::mutex_lock, DBusThreadFunctions::mutex_new, and DBusThreadFunctions::mutex_unlock.


Generated on Wed Jun 9 05:01:28 2004 for D-BUS by doxygen1.2.15