DBusThreadFunctions Struct Reference

struct DBusThreadFunctions

Functions that must be implemented to make the D-Bus library thread-aware. The recursive mutex functions should be specified rather than the old, deprecated nonrecursive ones.

The condition variable functions have to work with recursive mutexes if you provide those, or with nonrecursive mutexes if you provide those.

If implementing threads using pthreads, be aware that PTHREAD_MUTEX_RECURSIVE is broken in combination with condition variables. libdbus relies on the Java-style behavior that when waiting on a condition, the recursion count is saved and restored, and the mutex is completely unlocked, not just decremented one level of recursion.

Thus with pthreads you probably have to roll your own emulated recursive mutexes, you can't use PTHREAD_MUTEX_RECURSIVE. This is what dbus_threads_init_default() does on platforms that use pthreads.

Public Attributes
DBusCondVarFreeFunction condvar_free
DBusCondVarNewFunction condvar_new
DBusCondVarWaitFunction condvar_wait
DBusCondVarWaitTimeoutFunction condvar_wait_timeout
DBusCondVarWakeAllFunction condvar_wake_all
DBusCondVarWakeOneFunction condvar_wake_one
unsigned int mask
DBusMutexFreeFunction mutex_free
DBusMutexLockFunction mutex_lock
DBusMutexNewFunction mutex_new
DBusMutexUnlockFunction mutex_unlock
void(* padding1
void(* padding2
void(* padding3
void(* padding4
DBusRecursiveMutexFreeFunction recursive_mutex_free
DBusRecursiveMutexLockFunction recursive_mutex_lock
DBusRecursiveMutexNewFunction recursive_mutex_new
DBusRecursiveMutexUnlockFunction recursive_mutex_unlock

Member Data Documentation

DBusCondVarFreeFunction condvar_free

DBusCondVarFreeFunction condvar_free

Function to free a condition variable

DBusCondVarNewFunction condvar_new

DBusCondVarNewFunction condvar_new

Function to create a condition variable

DBusCondVarWaitFunction condvar_wait

DBusCondVarWaitFunction condvar_wait

Function to wait on a condition

DBusCondVarWaitTimeoutFunction condvar_wait_timeout

DBusCondVarWaitTimeoutFunction condvar_wait_timeout

Function to wait on a condition with a timeout

DBusCondVarWakeAllFunction condvar_wake_all

DBusCondVarWakeAllFunction condvar_wake_all

Function to wake all threads waiting on the condition

DBusCondVarWakeOneFunction condvar_wake_one

DBusCondVarWakeOneFunction condvar_wake_one

Function to wake one thread waiting on the condition

unsigned int mask

unsigned int mask

Mask indicating which functions are present.

DBusMutexFreeFunction mutex_free

DBusMutexFreeFunction mutex_free

Function to free a mutex; optional and deprecated.

DBusMutexLockFunction mutex_lock

DBusMutexLockFunction mutex_lock

Function to lock a mutex; optional and deprecated.

DBusMutexNewFunction mutex_new

DBusMutexNewFunction mutex_new

Function to create a mutex; optional and deprecated.

DBusMutexUnlockFunction mutex_unlock

DBusMutexUnlockFunction mutex_unlock

Function to unlock a mutex; optional and deprecated.

void(* padding1

void(* padding1

Reserved for future expansion

void(* padding2

void(* padding2

Reserved for future expansion

void(* padding3

void(* padding3

Reserved for future expansion

void(* padding4

void(* padding4

Reserved for future expansion

DBusRecursiveMutexFreeFunction recursive_mutex_free

DBusRecursiveMutexFreeFunction recursive_mutex_free

Function to free a recursive mutex

DBusRecursiveMutexLockFunction recursive_mutex_lock

DBusRecursiveMutexLockFunction recursive_mutex_lock

Function to lock a recursive mutex

DBusRecursiveMutexNewFunction recursive_mutex_new

DBusRecursiveMutexNewFunction recursive_mutex_new

Function to create a recursive mutex

DBusRecursiveMutexUnlockFunction recursive_mutex_unlock

DBusRecursiveMutexUnlockFunction recursive_mutex_unlock

Function to unlock a recursive mutex