Coverage report for dbus/dbus-threads.c.gcov

        -:    0:Source:dbus-threads.c
        -:    0:Graph:.libs/dbus-threads.gcno
        -:    0:Data:.libs/dbus-threads.gcda
        -:    0:Runs:11819
        -:    0:Programs:5
        -:    1:/* -*- mode: C; c-file-style: "gnu" -*- */
        -:    2:/* dbus-threads.h  D-BUS threads handling
        -:    3: *
        -:    4: * Copyright (C) 2002, 2003 Red Hat Inc.
        -:    5: *
        -:    6: * Licensed under the Academic Free License version 2.1
        -:    7: * 
        -:    8: * This program is free software; you can redistribute it and/or modify
        -:    9: * it under the terms of the GNU General Public License as published by
        -:   10: * the Free Software Foundation; either version 2 of the License, or
        -:   11: * (at your option) any later version.
        -:   12: *
        -:   13: * This program is distributed in the hope that it will be useful,
        -:   14: * but WITHOUT ANY WARRANTY; without even the implied warranty of
        -:   15: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        -:   16: * GNU General Public License for more details.
        -:   17: * 
        -:   18: * You should have received a copy of the GNU General Public License
        -:   19: * along with this program; if not, write to the Free Software
        -:   20: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
        -:   21: *
        -:   22: */
        -:   23:#include "dbus-threads.h"
        -:   24:#include "dbus-internals.h"
        -:   25:#include "dbus-threads-internal.h"
        -:   26:
        -:   27:static DBusThreadFunctions thread_functions =
        -:   28:{
        -:   29:  0,
        -:   30:  NULL, NULL, NULL, NULL,
        -:   31:  NULL, NULL, NULL, NULL, NULL,
        -:   32:
        -:   33:  NULL, NULL, NULL, NULL,
        -:   34:  NULL, NULL, NULL, NULL
        -:   35:};
        -:   36:static int thread_init_generation = 0;
        -:   37:
        -:   38:/** This is used for the no-op default mutex pointer, just to be distinct from #NULL */
        -:   39:#define _DBUS_DUMMY_MUTEX ((DBusMutex*)0xABCDEF)
        -:   40:
        -:   41:/** This is used for the no-op default mutex pointer, just to be distinct from #NULL */
        -:   42:#define _DBUS_DUMMY_CONDVAR ((DBusCondVar*)0xABCDEF2)
        -:   43:
        -:   44:/**
        -:   45: * @defgroup DBusThreadsInternals Thread functions
        -:   46: * @ingroup  DBusInternals
        -:   47: * @brief _dbus_mutex_lock(), etc.
        -:   48: *
        -:   49: * Functions and macros related to threads and thread locks.
        -:   50: *
        -:   51: * @{
        -:   52: */
        -:   53:
        -:   54:/**
        -:   55: * Creates a new mutex using the function supplied to dbus_threads_init(),
        -:   56: * or creates a no-op mutex if threads are not initialized.
        -:   57: * May return #NULL even if threads are initialized, indicating
        -:   58: * out-of-memory.
        -:   59: *
        -:   60: * @returns new mutex or #NULL
        -:   61: */
        -:   62:DBusMutex*
        -:   63:_dbus_mutex_new (void)
function _dbus_mutex_new called 43077 returned 100% blocks executed 100%
    43077:   64:{
    43077:   65:  if (thread_functions.mutex_new)
branch  0 taken 1% (fallthrough)
branch  1 taken 99%
       22:   66:    return (* thread_functions.mutex_new) ();
call    0 returned 100%
        -:   67:  else
    43055:   68:    return _DBUS_DUMMY_MUTEX;
        -:   69:}
        -:   70:
        -:   71:/**
        -:   72: * Frees a mutex created with dbus_mutex_new(); does
        -:   73: * nothing if passed a #NULL pointer.
        -:   74: */
        -:   75:void
        -:   76:_dbus_mutex_free (DBusMutex *mutex)
function _dbus_mutex_free called 41826 returned 100% blocks executed 100%
    41826:   77:{
    41826:   78:  if (mutex && thread_functions.mutex_free)
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
branch  2 taken 1% (fallthrough)
branch  3 taken 99%
       22:   79:    (* thread_functions.mutex_free) (mutex);
call    0 returned 100%
    41826:   80:}
        -:   81:
        -:   82:/**
        -:   83: * Locks a mutex. Does nothing if passed a #NULL pointer.
        -:   84: * Locks are not recursive.
        -:   85: *
        -:   86: * @returns #TRUE on success
        -:   87: */
        -:   88:dbus_bool_t
        -:   89:_dbus_mutex_lock (DBusMutex *mutex)
function _dbus_mutex_lock called 13266733 returned 100% blocks executed 100%
 13266733:   90:{
 13266733:   91:  if (mutex && thread_functions.mutex_lock)
branch  0 taken 35% (fallthrough)
branch  1 taken 65%
branch  2 taken 1% (fallthrough)
branch  3 taken 99%
      671:   92:    return (* thread_functions.mutex_lock) (mutex);
call    0 returned 100%
        -:   93:  else
 13266062:   94:    return TRUE;
        -:   95:}
        -:   96:
        -:   97:/**
        -:   98: * Unlocks a mutex. Does nothing if passed a #NULL pointer.
        -:   99: *
        -:  100: * @returns #TRUE on success
        -:  101: */
        -:  102:dbus_bool_t
        -:  103:_dbus_mutex_unlock (DBusMutex *mutex)
function _dbus_mutex_unlock called 13266709 returned 100% blocks executed 100%
 13266709:  104:{
 13266709:  105:  if (mutex && thread_functions.mutex_unlock)
branch  0 taken 35% (fallthrough)
branch  1 taken 65%
branch  2 taken 1% (fallthrough)
branch  3 taken 99%
      671:  106:    return (* thread_functions.mutex_unlock) (mutex);
call    0 returned 100%
        -:  107:  else
 13266038:  108:    return TRUE;
        -:  109:}
        -:  110:
        -:  111:/**
        -:  112: * Creates a new condition variable using the function supplied
        -:  113: * to dbus_threads_init(), or creates a no-op condition variable
        -:  114: * if threads are not initialized. May return #NULL even if
        -:  115: * threads are initialized, indicating out-of-memory.
        -:  116: *
        -:  117: * @returns new mutex or #NULL
        -:  118: */
        -:  119:DBusCondVar *
        -:  120:_dbus_condvar_new (void)
function _dbus_condvar_new called 28700 returned 100% blocks executed 60%
    28700:  121:{
    28700:  122:  if (thread_functions.condvar_new)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####:  123:    return (* thread_functions.condvar_new) ();
call    0 never executed
        -:  124:  else
    28700:  125:    return _DBUS_DUMMY_CONDVAR;
        -:  126:}
        -:  127:
        -:  128:/**
        -:  129: * Frees a conditional variable created with dbus_condvar_new(); does
        -:  130: * nothing if passed a #NULL pointer.
        -:  131: */
        -:  132:void
        -:  133:_dbus_condvar_free (DBusCondVar *cond)
function _dbus_condvar_free called 27866 returned 100% blocks executed 75%
    27866:  134:{
    27866:  135:  if (cond && thread_functions.condvar_free)
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
branch  2 taken 0% (fallthrough)
branch  3 taken 100%
    #####:  136:    (* thread_functions.condvar_free) (cond);
call    0 never executed
    27866:  137:}
        -:  138:
        -:  139:/**
        -:  140: * Atomically unlocks the mutex and waits for the conditions
        -:  141: * variable to be signalled. Locks the mutex again before
        -:  142: * returning.
        -:  143: * Does nothing if passed a #NULL pointer.
        -:  144: */
        -:  145:void
        -:  146:_dbus_condvar_wait (DBusCondVar *cond,
        -:  147:                    DBusMutex   *mutex)
function _dbus_condvar_wait called 0 returned 0% blocks executed 0%
    #####:  148:{
    #####:  149:  if (cond && mutex && thread_functions.condvar_wait)
branch  0 never executed
branch  1 never executed
branch  2 never executed
branch  3 never executed
branch  4 never executed
branch  5 never executed
    #####:  150:    (* thread_functions.condvar_wait) (cond, mutex);
call    0 never executed
    #####:  151:}
        -:  152:
        -:  153:/**
        -:  154: * Atomically unlocks the mutex and waits for the conditions
        -:  155: * variable to be signalled, or for a timeout. Locks the
        -:  156: * mutex again before returning.
        -:  157: * Does nothing if passed a #NULL pointer.
        -:  158: *
        -:  159: * @param cond the condition variable
        -:  160: * @param mutex the mutex
        -:  161: * @param timeout_milliseconds the maximum time to wait
        -:  162: * @returns TRUE if the condition was reached, or FALSE if the
        -:  163: * timeout was reached.
        -:  164: */
        -:  165:dbus_bool_t
        -:  166:_dbus_condvar_wait_timeout (DBusCondVar               *cond,
        -:  167:                            DBusMutex                 *mutex,
        -:  168:                            int                        timeout_milliseconds)
function _dbus_condvar_wait_timeout called 0 returned 0% blocks executed 0%
    #####:  169:{
    #####:  170:  if (cond && mutex && thread_functions.condvar_wait)
branch  0 never executed
branch  1 never executed
branch  2 never executed
branch  3 never executed
branch  4 never executed
branch  5 never executed
    #####:  171:    return (* thread_functions.condvar_wait_timeout) (cond, mutex, timeout_milliseconds);
call    0 never executed
        -:  172:  else
    #####:  173:    return TRUE;
        -:  174:}
        -:  175:
        -:  176:/**
        -:  177: * If there are threads waiting on the condition variable, wake
        -:  178: * up exactly one. 
        -:  179: * Does nothing if passed a #NULL pointer.
        -:  180: */
        -:  181:void
        -:  182:_dbus_condvar_wake_one (DBusCondVar *cond)
function _dbus_condvar_wake_one called 288490 returned 100% blocks executed 75%
   288490:  183:{
   288490:  184:  if (cond && thread_functions.condvar_wake_one)
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
branch  2 taken 0% (fallthrough)
branch  3 taken 100%
    #####:  185:    (* thread_functions.condvar_wake_one) (cond);
call    0 never executed
   288490:  186:}
        -:  187:
        -:  188:/**
        -:  189: * If there are threads waiting on the condition variable, wake
        -:  190: * up all of them. 
        -:  191: * Does nothing if passed a #NULL pointer.
        -:  192: */
        -:  193:void
        -:  194:_dbus_condvar_wake_all (DBusCondVar *cond)
function _dbus_condvar_wake_all called 0 returned 0% blocks executed 0%
    #####:  195:{
    #####:  196:  if (cond && thread_functions.condvar_wake_all)
branch  0 never executed
branch  1 never executed
branch  2 never executed
branch  3 never executed
    #####:  197:    (* thread_functions.condvar_wake_all) (cond);
call    0 never executed
    #####:  198:}
        -:  199:
        -:  200:static void
        -:  201:shutdown_global_locks (void *data)
function shutdown_global_locks called 1 returned 100% blocks executed 100%
        1:  202:{
        1:  203:  DBusMutex ***locks = data;
        -:  204:  int i;
        -:  205:
        1:  206:  i = 0;
       13:  207:  while (i < _DBUS_N_GLOBAL_LOCKS)
branch  0 taken 92%
branch  1 taken 8% (fallthrough)
        -:  208:    {
       11:  209:      _dbus_mutex_free (*(locks[i]));
call    0 returned 100%
       11:  210:      *(locks[i]) = NULL;
       11:  211:      ++i;
        -:  212:    }
        -:  213:  
        1:  214:  dbus_free (locks);
call    0 returned 100%
        1:  215:}
        -:  216:
        -:  217:static dbus_bool_t
        -:  218:init_global_locks (void)
function init_global_locks called 1 returned 100% blocks executed 57%
        1:  219:{
        -:  220:  int i;
        -:  221:  DBusMutex ***dynamic_global_locks;
        -:  222:  
        -:  223:  DBusMutex **global_locks[] = {
        -:  224:#define LOCK_ADDR(name) (& _dbus_lock_##name)
        -:  225:    LOCK_ADDR (list),
        -:  226:    LOCK_ADDR (connection_slots),
        -:  227:    LOCK_ADDR (pending_call_slots),
        -:  228:    LOCK_ADDR (server_slots),
        -:  229:    LOCK_ADDR (message_slots),
        -:  230:    LOCK_ADDR (atomic),
        -:  231:    LOCK_ADDR (bus),
        -:  232:    LOCK_ADDR (shutdown_funcs),
        -:  233:    LOCK_ADDR (system_users),
        -:  234:    LOCK_ADDR (message_cache),
        -:  235:    LOCK_ADDR (shared_connections)
        -:  236:#undef LOCK_ADDR
        1:  237:  };
        -:  238:
        1:  239:  _dbus_assert (_DBUS_N_ELEMENTS (global_locks) ==
call    0 returned 100%
        -:  240:                _DBUS_N_GLOBAL_LOCKS);
        -:  241:
        1:  242:  i = 0;
        -:  243:  
        1:  244:  dynamic_global_locks = dbus_new (DBusMutex**, _DBUS_N_GLOBAL_LOCKS);
call    0 returned 100%
        1:  245:  if (dynamic_global_locks == NULL)
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
    #####:  246:    goto failed;
        -:  247:  
       13:  248:  while (i < _DBUS_N_ELEMENTS (global_locks))
branch  0 taken 92%
branch  1 taken 8% (fallthrough)
        -:  249:    {
       11:  250:      *global_locks[i] = _dbus_mutex_new ();
call    0 returned 100%
        -:  251:      
       11:  252:      if (*global_locks[i] == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####:  253:        goto failed;
        -:  254:
       11:  255:      dynamic_global_locks[i] = global_locks[i];
        -:  256:
       11:  257:      ++i;
        -:  258:    }
        -:  259:  
        1:  260:  if (!_dbus_register_shutdown_func (shutdown_global_locks,
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -:  261:                                     dynamic_global_locks))
    #####:  262:    goto failed;
        -:  263:  
        1:  264:  return TRUE;
        -:  265:
    #####:  266: failed:
    #####:  267:  dbus_free (dynamic_global_locks);
call    0 never executed
        -:  268:                                     
    #####:  269:  for (i = i - 1; i >= 0; i--)
branch  0 never executed
branch  1 never executed
        -:  270:    {
    #####:  271:      _dbus_mutex_free (*global_locks[i]);
call    0 never executed
    #####:  272:      *global_locks[i] = NULL;
        -:  273:    }
    #####:  274:  return FALSE;
        -:  275:}
        -:  276:
        -:  277:/** @} */ /* end of internals */
        -:  278:
        -:  279:/**
        -:  280: * @defgroup DBusThreads Thread functions
        -:  281: * @ingroup  DBus
        -:  282: * @brief dbus_threads_init()
        -:  283: *
        -:  284: * Functions and macros related to threads and thread locks.
        -:  285: *
        -:  286: * @{
        -:  287: */
        -:  288:
        -:  289:/**
        -:  290: * 
        -:  291: * Initializes threads. If this function is not called,
        -:  292: * the D-BUS library will not lock any data structures.
        -:  293: * If it is called, D-BUS will do locking, at some cost
        -:  294: * in efficiency. Note that this function must be called
        -:  295: * BEFORE using any other D-BUS functions.
        -:  296: *
        -:  297: * This function may be called more than once, as long
        -:  298: * as you pass in the same functions each time. If it's
        -:  299: * called multiple times with different functions, then
        -:  300: * a warning is printed, because someone is confused.
        -:  301: *
        -:  302: * @param functions functions for using threads
        -:  303: * @returns #TRUE on success, #FALSE if no memory
        -:  304: */
        -:  305:dbus_bool_t
        -:  306:dbus_threads_init (const DBusThreadFunctions *functions)
function dbus_threads_init called 1 returned 100% blocks executed 81%
        1:  307:{
        1:  308:  _dbus_assert (functions != NULL);
call    0 returned 100%
        -:  309:
        -:  310:  /* these base functions are required. Future additions to
        -:  311:   * DBusThreadFunctions may be optional.
        -:  312:   */
        1:  313:  _dbus_assert (functions->mask & DBUS_THREAD_FUNCTIONS_MUTEX_NEW_MASK);
call    0 returned 100%
        1:  314:  _dbus_assert (functions->mask & DBUS_THREAD_FUNCTIONS_MUTEX_FREE_MASK);
call    0 returned 100%
        1:  315:  _dbus_assert (functions->mask & DBUS_THREAD_FUNCTIONS_MUTEX_LOCK_MASK);
call    0 returned 100%
        1:  316:  _dbus_assert (functions->mask & DBUS_THREAD_FUNCTIONS_MUTEX_UNLOCK_MASK);
call    0 returned 100%
        1:  317:  _dbus_assert (functions->mask & DBUS_THREAD_FUNCTIONS_CONDVAR_NEW_MASK);
call    0 returned 100%
        1:  318:  _dbus_assert (functions->mask & DBUS_THREAD_FUNCTIONS_CONDVAR_FREE_MASK);
call    0 returned 100%
        1:  319:  _dbus_assert (functions->mask & DBUS_THREAD_FUNCTIONS_CONDVAR_WAIT_MASK);
call    0 returned 100%
        1:  320:  _dbus_assert (functions->mask & DBUS_THREAD_FUNCTIONS_CONDVAR_WAIT_TIMEOUT_MASK);
call    0 returned 100%
        1:  321:  _dbus_assert (functions->mask & DBUS_THREAD_FUNCTIONS_CONDVAR_WAKE_ONE_MASK);
call    0 returned 100%
        1:  322:  _dbus_assert (functions->mask & DBUS_THREAD_FUNCTIONS_CONDVAR_WAKE_ALL_MASK);
call    0 returned 100%
        1:  323:  _dbus_assert (functions->mutex_new != NULL);
call    0 returned 100%
        1:  324:  _dbus_assert (functions->mutex_free != NULL);
call    0 returned 100%
        1:  325:  _dbus_assert (functions->mutex_lock != NULL);
call    0 returned 100%
        1:  326:  _dbus_assert (functions->mutex_unlock != NULL);
call    0 returned 100%
        1:  327:  _dbus_assert (functions->condvar_new != NULL);
call    0 returned 100%
        1:  328:  _dbus_assert (functions->condvar_free != NULL);
call    0 returned 100%
        1:  329:  _dbus_assert (functions->condvar_wait != NULL);
call    0 returned 100%
        1:  330:  _dbus_assert (functions->condvar_wait_timeout != NULL);
call    0 returned 100%
        1:  331:  _dbus_assert (functions->condvar_wake_one != NULL);
call    0 returned 100%
        1:  332:  _dbus_assert (functions->condvar_wake_all != NULL);
call    0 returned 100%
        -:  333:
        -:  334:  /* Check that all bits in the mask actually are valid mask bits.
        -:  335:   * ensures people won't write code that breaks when we add
        -:  336:   * new bits.
        -:  337:   */
        1:  338:  _dbus_assert ((functions->mask & ~DBUS_THREAD_FUNCTIONS_ALL_MASK) == 0);
call    0 returned 100%
        -:  339:
        1:  340:  if (thread_init_generation != _dbus_current_generation)
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
        1:  341:    thread_functions.mask = 0; /* allow re-init in new generation */
        -:  342:  
        1:  343:  if (thread_functions.mask != 0)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
        -:  344:    {
        -:  345:      /* Silently allow multiple init if the functions are the same ones.
        -:  346:       * Well, we only bother checking two of them, just out of laziness.
        -:  347:       */
    #####:  348:      if (thread_functions.mask == functions->mask &&
branch  0 never executed
branch  1 never executed
branch  2 never executed
branch  3 never executed
branch  4 never executed
branch  5 never executed
        -:  349:          thread_functions.mutex_new == functions->mutex_new &&
        -:  350:          thread_functions.condvar_new == functions->condvar_new)
        -:  351:        {
    #####:  352:          return TRUE;
        -:  353:        }
        -:  354:      else
        -:  355:        {
    #####:  356:          _dbus_warn ("dbus_threads_init() called twice with two different sets of functions\n");
call    0 never executed
    #####:  357:          return FALSE;
        -:  358:        }
        -:  359:    }
        -:  360:  
        1:  361:  thread_functions.mutex_new = functions->mutex_new;
        1:  362:  thread_functions.mutex_free = functions->mutex_free;
        1:  363:  thread_functions.mutex_lock = functions->mutex_lock;
        1:  364:  thread_functions.mutex_unlock = functions->mutex_unlock;
        -:  365:  
        1:  366:  thread_functions.condvar_new = functions->condvar_new;
        1:  367:  thread_functions.condvar_free = functions->condvar_free;
        1:  368:  thread_functions.condvar_wait = functions->condvar_wait;
        1:  369:  thread_functions.condvar_wait_timeout = functions->condvar_wait_timeout;
        1:  370:  thread_functions.condvar_wake_one = functions->condvar_wake_one;
        1:  371:  thread_functions.condvar_wake_all = functions->condvar_wake_all;
        -:  372:  
        1:  373:  thread_functions.mask = functions->mask;
        -:  374:
        1:  375:  if (!init_global_locks ())
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  376:    return FALSE;
        -:  377:
        1:  378:  thread_init_generation = _dbus_current_generation;
        -:  379:  
        1:  380:  return TRUE;
        -:  381:}
        -:  382:
        -:  383:/** @} */
        -:  384:
        -:  385:#ifdef DBUS_BUILD_TESTS
        -:  386:/** Fake mutex used for debugging */
        -:  387:typedef struct DBusFakeMutex DBusFakeMutex;
        -:  388:/** Fake mutex used for debugging */
        -:  389:struct DBusFakeMutex
        -:  390:{
        -:  391:  dbus_bool_t locked; /**< Mutex is "locked" */
        -:  392:};	
        -:  393:
        -:  394:static DBusMutex *  dbus_fake_mutex_new            (void);
        -:  395:static void         dbus_fake_mutex_free           (DBusMutex   *mutex);
        -:  396:static dbus_bool_t  dbus_fake_mutex_lock           (DBusMutex   *mutex);
        -:  397:static dbus_bool_t  dbus_fake_mutex_unlock         (DBusMutex   *mutex);
        -:  398:static DBusCondVar* dbus_fake_condvar_new          (void);
        -:  399:static void         dbus_fake_condvar_free         (DBusCondVar *cond);
        -:  400:static void         dbus_fake_condvar_wait         (DBusCondVar *cond,
        -:  401:                                                    DBusMutex   *mutex);
        -:  402:static dbus_bool_t  dbus_fake_condvar_wait_timeout (DBusCondVar *cond,
        -:  403:                                                    DBusMutex   *mutex,
        -:  404:                                                    int          timeout_msec);
        -:  405:static void         dbus_fake_condvar_wake_one     (DBusCondVar *cond);
        -:  406:static void         dbus_fake_condvar_wake_all     (DBusCondVar *cond);
        -:  407:
        -:  408:
        -:  409:static const DBusThreadFunctions fake_functions =
        -:  410:{
        -:  411:  DBUS_THREAD_FUNCTIONS_MUTEX_NEW_MASK |
        -:  412:  DBUS_THREAD_FUNCTIONS_MUTEX_FREE_MASK |
        -:  413:  DBUS_THREAD_FUNCTIONS_MUTEX_LOCK_MASK |
        -:  414:  DBUS_THREAD_FUNCTIONS_MUTEX_UNLOCK_MASK |
        -:  415:  DBUS_THREAD_FUNCTIONS_CONDVAR_NEW_MASK |
        -:  416:  DBUS_THREAD_FUNCTIONS_CONDVAR_FREE_MASK |
        -:  417:  DBUS_THREAD_FUNCTIONS_CONDVAR_WAIT_MASK |
        -:  418:  DBUS_THREAD_FUNCTIONS_CONDVAR_WAIT_TIMEOUT_MASK |
        -:  419:  DBUS_THREAD_FUNCTIONS_CONDVAR_WAKE_ONE_MASK|
        -:  420:  DBUS_THREAD_FUNCTIONS_CONDVAR_WAKE_ALL_MASK,
        -:  421:  dbus_fake_mutex_new,
        -:  422:  dbus_fake_mutex_free,
        -:  423:  dbus_fake_mutex_lock,
        -:  424:  dbus_fake_mutex_unlock,
        -:  425:  dbus_fake_condvar_new,
        -:  426:  dbus_fake_condvar_free,
        -:  427:  dbus_fake_condvar_wait,
        -:  428:  dbus_fake_condvar_wait_timeout,
        -:  429:  dbus_fake_condvar_wake_one,
        -:  430:  dbus_fake_condvar_wake_all
        -:  431:};
        -:  432:
        -:  433:static DBusMutex *
        -:  434:dbus_fake_mutex_new (void)
function dbus_fake_mutex_new called 22 returned 100% blocks executed 100%
       22:  435:{
        -:  436:  DBusFakeMutex *mutex;
        -:  437:
       22:  438:  mutex = dbus_new0 (DBusFakeMutex, 1);
call    0 returned 100%
        -:  439:
       22:  440:  return (DBusMutex *)mutex;
        -:  441:}
        -:  442:
        -:  443:static void
        -:  444:dbus_fake_mutex_free (DBusMutex *mutex)
function dbus_fake_mutex_free called 22 returned 100% blocks executed 100%
       22:  445:{
       22:  446:  DBusFakeMutex *fake = (DBusFakeMutex*) mutex;
        -:  447:
       22:  448:  _dbus_assert (!fake->locked);
call    0 returned 100%
        -:  449:  
       22:  450:  dbus_free (fake);
call    0 returned 100%
       22:  451:}
        -:  452:
        -:  453:static dbus_bool_t
        -:  454:dbus_fake_mutex_lock (DBusMutex *mutex)
function dbus_fake_mutex_lock called 671 returned 100% blocks executed 100%
      671:  455:{
      671:  456:  DBusFakeMutex *fake = (DBusFakeMutex*) mutex;
        -:  457:
      671:  458:  _dbus_assert (!fake->locked);
call    0 returned 100%
        -:  459:
      671:  460:  fake->locked = TRUE;
        -:  461:  
      671:  462:  return TRUE;
        -:  463:}
        -:  464:
        -:  465:static dbus_bool_t
        -:  466:dbus_fake_mutex_unlock (DBusMutex *mutex)
function dbus_fake_mutex_unlock called 671 returned 100% blocks executed 100%
      671:  467:{
      671:  468:  DBusFakeMutex *fake = (DBusFakeMutex*) mutex;
        -:  469:
      671:  470:  _dbus_assert (fake->locked);
call    0 returned 100%
        -:  471:
      671:  472:  fake->locked = FALSE;
        -:  473:  
      671:  474:  return TRUE;
        -:  475:}
        -:  476:
        -:  477:static DBusCondVar*
        -:  478:dbus_fake_condvar_new (void)
function dbus_fake_condvar_new called 0 returned 0% blocks executed 0%
    #####:  479:{
    #####:  480:  return (DBusCondVar*) _dbus_strdup ("FakeCondvar");
call    0 never executed
        -:  481:}
        -:  482:
        -:  483:static void
        -:  484:dbus_fake_condvar_free (DBusCondVar *cond)
function dbus_fake_condvar_free called 0 returned 0% blocks executed 0%
    #####:  485:{
    #####:  486:  dbus_free (cond);
call    0 never executed
    #####:  487:}
        -:  488:
        -:  489:static void
        -:  490:dbus_fake_condvar_wait (DBusCondVar *cond,
        -:  491:                        DBusMutex   *mutex)
function dbus_fake_condvar_wait called 0 returned 0% blocks executed 0%
    #####:  492:{
        -:  493:  
    #####:  494:}
        -:  495:
        -:  496:static dbus_bool_t
        -:  497:dbus_fake_condvar_wait_timeout (DBusCondVar *cond,
        -:  498:                                DBusMutex   *mutex,
        -:  499:                                int         timeout_msec)
function dbus_fake_condvar_wait_timeout called 0 returned 0% blocks executed 0%
    #####:  500:{
    #####:  501:  return TRUE;
        -:  502:}
        -:  503:
        -:  504:static void
        -:  505:dbus_fake_condvar_wake_one (DBusCondVar *cond)
function dbus_fake_condvar_wake_one called 0 returned 0% blocks executed 0%
    #####:  506:{
        -:  507:
    #####:  508:}
        -:  509:
        -:  510:static void
        -:  511:dbus_fake_condvar_wake_all (DBusCondVar *cond)
function dbus_fake_condvar_wake_all called 0 returned 0% blocks executed 0%
    #####:  512:{
        -:  513:
    #####:  514:}
        -:  515:
        -:  516:dbus_bool_t
        -:  517:_dbus_threads_init_debug (void)
function _dbus_threads_init_debug called 1 returned 100% blocks executed 100%
        1:  518:{
        1:  519:  return dbus_threads_init (&fake_functions);
call    0 returned 100%
        -:  520:}
        -:  521:
        -:  522:#endif /* DBUS_BUILD_TESTS */