26#include "dbus-threads.h" 
   27#include "dbus-internals.h" 
   28#include "dbus-threads-internal.h" 
   32static int thread_init_generation = 0;
 
   66  *location_p = _dbus_platform_rmutex_new ();
 
 
   90  *location_p = _dbus_platform_cmutex_new ();
 
 
   99  if (location_p == 
NULL)
 
  102  if (*location_p != 
NULL)
 
  103    _dbus_platform_rmutex_free (*location_p);
 
 
  112  if (location_p == 
NULL)
 
  115  if (*location_p != 
NULL)
 
  116    _dbus_platform_cmutex_free (*location_p);
 
 
  130  _dbus_platform_rmutex_lock (mutex);
 
 
  144  _dbus_platform_cmutex_lock (mutex);
 
 
  158  _dbus_platform_rmutex_unlock (mutex);
 
 
  172  _dbus_platform_cmutex_unlock (mutex);
 
 
  189  return _dbus_platform_condvar_new ();
 
 
  220  _dbus_platform_condvar_free (cond);
 
 
  229  if (location_p == 
NULL)
 
  232  if (*location_p != 
NULL)
 
  233    _dbus_platform_condvar_free (*location_p);
 
 
  249  _dbus_platform_condvar_wait (cond, mutex);
 
 
  266                            int                        timeout_milliseconds)
 
  271  return _dbus_platform_condvar_wait_timeout (cond, mutex,
 
  272      timeout_milliseconds);
 
 
  286  _dbus_platform_condvar_wake_one (cond);
 
 
  293shutdown_global_locks (
void *nil)
 
  297  for (i = 0; i < _DBUS_N_GLOBAL_LOCKS; i++)
 
  300      _dbus_platform_rmutex_free (global_locks[i]);
 
  301      global_locks[i] = 
NULL;
 
  306init_global_locks (
void)
 
  311  for (i = 0; i < _DBUS_N_GLOBAL_LOCKS; i++)
 
  315      global_locks[i] = _dbus_platform_rmutex_new ();
 
  317      if (global_locks[i] == 
NULL)
 
  321  _dbus_platform_rmutex_lock (global_locks[_DBUS_LOCK_shutdown_funcs]);
 
  322  ok = _dbus_register_shutdown_func_unlocked (shutdown_global_locks, 
NULL);
 
  323  _dbus_platform_rmutex_unlock (global_locks[_DBUS_LOCK_shutdown_funcs]);
 
  331  for (i = i - 1; i >= 0; i--)
 
  333      _dbus_platform_rmutex_free (global_locks[i]);
 
  334      global_locks[i] = 
NULL;
 
  341_dbus_lock (DBusGlobalLock lock)
 
  350  _dbus_platform_rmutex_lock (global_locks[lock]);
 
  355_dbus_unlock (DBusGlobalLock lock)
 
  360  _dbus_platform_rmutex_unlock (global_locks[lock]);
 
  406      !init_global_locks ())
 
 
  450#ifdef DBUS_ENABLE_EMBEDDED_TESTS 
#define _dbus_assert(condition)
Aborts with an error message if the condition is false.
#define NULL
A null pointer, defined appropriately for C or C++.
#define TRUE
Expands to "1".
#define FALSE
Expands to "0".
int _dbus_current_generation
_dbus_current_generation is used to track each time that dbus_shutdown() is called,...
void _dbus_threads_lock_platform_specific(void)
Lock a static mutex used to protect _dbus_threads_init_platform_specific().
void _dbus_threads_unlock_platform_specific(void)
Undo _dbus_threads_lock_platform_specific().
dbus_bool_t _dbus_threads_init_platform_specific(void)
Initialize threads as in dbus_threads_init_default(), appropriately for the platform.
void _dbus_rmutex_new_at_location(DBusRMutex **location_p)
Creates a new mutex or creates a no-op mutex if threads are not initialized.
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_condvar_free_at_location(DBusCondVar **location_p)
Frees a condition variable; does nothing if passed a NULL pointer.
void _dbus_rmutex_unlock(DBusRMutex *mutex)
Unlocks a mutex.
void _dbus_condvar_wait(DBusCondVar *cond, DBusCMutex *mutex)
Atomically unlocks the mutex and waits for the conditions variable to be signalled.
void _dbus_condvar_new_at_location(DBusCondVar **location_p)
This does the same thing as _dbus_condvar_new.
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_condvar_wake_one(DBusCondVar *cond)
If there are threads waiting on the condition variable, wake up exactly one.
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_cmutex_lock(DBusCMutex *mutex)
Locks a mutex.
void _dbus_cmutex_unlock(DBusCMutex *mutex)
Unlocks a mutex.
void _dbus_rmutex_free_at_location(DBusRMutex **location_p)
Frees a DBusRMutex; does nothing if passed a NULL pointer.
void _dbus_rmutex_lock(DBusRMutex *mutex)
Locks a mutex.
void _dbus_condvar_free(DBusCondVar *cond)
Frees a conditional variable created with dbus_condvar_new(); does nothing if passed a NULL pointer.
dbus_bool_t dbus_threads_init_default(void)
Initializes threads.
dbus_bool_t dbus_threads_init(const DBusThreadFunctions *functions)
Initializes threads, like dbus_threads_init_default().
dbus_uint32_t dbus_bool_t
A boolean, valid values are TRUE and FALSE.
Functions that must be implemented to make the D-Bus library thread-aware.