24 #include "dbus-threads.h" 
   25 #include "dbus-internals.h" 
   26 #include "dbus-threads-internal.h" 
   27 #include "dbus-list.h" 
   29 static int thread_init_generation = 0;
 
   63   *location_p = _dbus_platform_rmutex_new ();
 
   87   *location_p = _dbus_platform_cmutex_new ();
 
   96   if (location_p == 
NULL)
 
   99   if (*location_p != 
NULL)
 
  100     _dbus_platform_rmutex_free (*location_p);
 
  109   if (location_p == 
NULL)
 
  112   if (*location_p != 
NULL)
 
  113     _dbus_platform_cmutex_free (*location_p);
 
  127   _dbus_platform_rmutex_lock (mutex);
 
  141   _dbus_platform_cmutex_lock (mutex);
 
  155   _dbus_platform_rmutex_unlock (mutex);
 
  169   _dbus_platform_cmutex_unlock (mutex);
 
  186   return _dbus_platform_condvar_new ();
 
  217   _dbus_platform_condvar_free (cond);
 
  226   if (location_p == 
NULL)
 
  229   if (*location_p != 
NULL)
 
  230     _dbus_platform_condvar_free (*location_p);
 
  246   _dbus_platform_condvar_wait (cond, mutex);
 
  263                             int                        timeout_milliseconds)
 
  268   return _dbus_platform_condvar_wait_timeout (cond, mutex,
 
  269       timeout_milliseconds);
 
  283   _dbus_platform_condvar_wake_one (cond);
 
  289 shutdown_global_locks (
void *nil)
 
  293   for (i = 0; i < _DBUS_N_GLOBAL_LOCKS; i++)
 
  296       _dbus_platform_rmutex_free (global_locks[i]);
 
  297       global_locks[i] = 
NULL;
 
  302 init_global_locks (
void)
 
  307   for (i = 0; i < _DBUS_N_GLOBAL_LOCKS; i++)
 
  311       global_locks[i] = _dbus_platform_rmutex_new ();
 
  313       if (global_locks[i] == 
NULL)
 
  317   _dbus_platform_rmutex_lock (global_locks[_DBUS_LOCK_shutdown_funcs]);
 
  318   ok = _dbus_register_shutdown_func_unlocked (shutdown_global_locks, 
NULL);
 
  319   _dbus_platform_rmutex_unlock (global_locks[_DBUS_LOCK_shutdown_funcs]);
 
  327   for (i = i - 1; i >= 0; i--)
 
  329       _dbus_platform_rmutex_free (global_locks[i]);
 
  330       global_locks[i] = 
NULL;
 
  337 _dbus_lock (DBusGlobalLock 
lock)
 
  346   _dbus_platform_rmutex_lock (global_locks[
lock]);
 
  351 _dbus_unlock (DBusGlobalLock 
lock)
 
  356   _dbus_platform_rmutex_unlock (global_locks[
lock]);
 
  402       !init_global_locks ())
 
  446 #ifdef DBUS_ENABLE_EMBEDDED_TESTS 
  449 _dbus_threads_init_debug (
void)
 
  
void _dbus_threads_lock_platform_specific(void)
Lock a static mutex used to protect _dbus_threads_init_platform_specific().
Functions that must be implemented to make the D-Bus library thread-aware.
void _dbus_condvar_wake_one(DBusCondVar *cond)
If there are threads waiting on the condition variable, wake up exactly one.
int _dbus_current_generation
_dbus_current_generation is used to track each time that dbus_shutdown() is called,...
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_free_at_location(DBusCondVar **location_p)
Frees a condition variable; does nothing if passed a NULL pointer.
pthread_mutex_t lock
the lock
dbus_bool_t _dbus_condvar_wait_timeout(DBusCondVar *cond, DBusCMutex *mutex, int timeout_milliseconds)
Atomically unlocks the mutex and waits for the conditions variable to be signalled,...
void _dbus_condvar_wait(DBusCondVar *cond, DBusCMutex *mutex)
Atomically unlocks the mutex and waits for the conditions variable to be signalled.
void _dbus_cmutex_unlock(DBusCMutex *mutex)
Unlocks a mutex.
void _dbus_cmutex_new_at_location(DBusCMutex **location_p)
Creates a new mutex or creates a no-op mutex if threads are not initialized.
void _dbus_rmutex_unlock(DBusRMutex *mutex)
Unlocks a mutex.
dbus_bool_t _dbus_threads_init_platform_specific(void)
Initialize threads as in dbus_threads_init_default(), appropriately for the platform.
void _dbus_cmutex_lock(DBusCMutex *mutex)
Locks a mutex.
dbus_bool_t dbus_threads_init_default(void)
Initializes threads.
void _dbus_rmutex_lock(DBusRMutex *mutex)
Locks a mutex.
void _dbus_threads_unlock_platform_specific(void)
Undo _dbus_threads_lock_platform_specific().
#define _dbus_assert(condition)
void _dbus_condvar_new_at_location(DBusCondVar **location_p)
This does the same thing as _dbus_condvar_new.
dbus_bool_t dbus_threads_init(const DBusThreadFunctions *functions)
Initializes threads, like dbus_threads_init_default().
void _dbus_cmutex_free_at_location(DBusCMutex **location_p)
Frees a DBusCMutex; does nothing if passed a NULL pointer.
DBusCondVar * _dbus_condvar_new(void)
Creates a new condition variable using the function supplied to dbus_threads_init(),...
void _dbus_rmutex_free_at_location(DBusRMutex **location_p)
Frees a DBusRMutex; does nothing if passed a NULL pointer.
void _dbus_rmutex_new_at_location(DBusRMutex **location_p)
Creates a new mutex or creates a no-op mutex if threads are not initialized.
dbus_uint32_t dbus_bool_t