dbus-threads-internal.h
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/* dbus-threads-internal.h D-Bus thread primitives
*
* Copyright (C) 2002, 2005 Red Hat Inc.
*
* SPDX-License-Identifier: AFL-2.1 OR GPL-2.0-or-later
*
* Licensed under the Academic Free License version 2.1
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef DBUS_THREADS_INTERNAL_H
#define DBUS_THREADS_INTERNAL_H
#include <dbus/dbus-macros.h>
#include <dbus/dbus-types.h>
#include <dbus/dbus-threads.h>
typedef struct DBusRMutex DBusRMutex;
typedef struct DBusCMutex DBusCMutex;
DBUS_BEGIN_DECLS
DBUS_PRIVATE_EXPORT
void _dbus_rmutex_lock (DBusRMutex *mutex);
DBUS_PRIVATE_EXPORT
void _dbus_rmutex_unlock (DBusRMutex *mutex);
void _dbus_rmutex_new_at_location (DBusRMutex **location_p);
void _dbus_rmutex_free_at_location (DBusRMutex **location_p);
void _dbus_cmutex_lock (DBusCMutex *mutex);
void _dbus_cmutex_unlock (DBusCMutex *mutex);
void _dbus_cmutex_new_at_location (DBusCMutex **location_p);
void _dbus_cmutex_free_at_location (DBusCMutex **location_p);
DBusCondVar* _dbus_condvar_new (void);
void _dbus_condvar_free (DBusCondVar *cond);
void _dbus_condvar_wait (DBusCondVar *cond,
DBusCMutex *mutex);
dbus_bool_t _dbus_condvar_wait_timeout (DBusCondVar *cond,
DBusCMutex *mutex,
int timeout_milliseconds);
void _dbus_condvar_wake_one (DBusCondVar *cond);
void _dbus_condvar_new_at_location (DBusCondVar **location_p);
void _dbus_condvar_free_at_location (DBusCondVar **location_p);
/* Private to threading implementations and dbus-threads.c */
DBUS_EMBEDDED_TESTS_EXPORT
DBusRMutex *_dbus_platform_rmutex_new (void);
DBUS_EMBEDDED_TESTS_EXPORT
void _dbus_platform_rmutex_free (DBusRMutex *mutex);
DBUS_EMBEDDED_TESTS_EXPORT
void _dbus_platform_rmutex_lock (DBusRMutex *mutex);
DBUS_EMBEDDED_TESTS_EXPORT
void _dbus_platform_rmutex_unlock (DBusRMutex *mutex);
DBUS_EMBEDDED_TESTS_EXPORT
DBusCMutex *_dbus_platform_cmutex_new (void);
DBUS_EMBEDDED_TESTS_EXPORT
void _dbus_platform_cmutex_free (DBusCMutex *mutex);
DBUS_EMBEDDED_TESTS_EXPORT
void _dbus_platform_cmutex_lock (DBusCMutex *mutex);
DBUS_EMBEDDED_TESTS_EXPORT
void _dbus_platform_cmutex_unlock (DBusCMutex *mutex);
DBusCondVar* _dbus_platform_condvar_new (void);
void _dbus_platform_condvar_free (DBusCondVar *cond);
void _dbus_platform_condvar_wait (DBusCondVar *cond,
DBusCMutex *mutex);
dbus_bool_t _dbus_platform_condvar_wait_timeout (DBusCondVar *cond,
DBusCMutex *mutex,
int timeout_milliseconds);
void _dbus_platform_condvar_wake_one (DBusCondVar *cond);
DBUS_END_DECLS
#endif /* DBUS_THREADS_INTERNAL_H */
DBUS_BEGIN_DECLS
#define DBUS_BEGIN_DECLS
Macro used prior to declaring functions in the D-Bus header files.
Definition dbus-macros.h:36
DBUS_END_DECLS
#define DBUS_END_DECLS
Macro used after declaring functions in the D-Bus header files.
Definition dbus-macros.h:37
_dbus_rmutex_new_at_location
void _dbus_rmutex_new_at_location(DBusRMutex **location_p)
Creates a new mutex or creates a no-op mutex if threads are not initialized.
Definition dbus-threads.c:56
_dbus_cmutex_free_at_location
void _dbus_cmutex_free_at_location(DBusCMutex **location_p)
Frees a DBusCMutex; does nothing if passed a NULL pointer.
Definition dbus-threads.c:110
_dbus_condvar_new
DBusCondVar * _dbus_condvar_new(void)
Creates a new condition variable using the function supplied to dbus_threads_init(),...
Definition dbus-threads.c:184
_dbus_condvar_free_at_location
void _dbus_condvar_free_at_location(DBusCondVar **location_p)
Frees a condition variable; does nothing if passed a NULL pointer.
Definition dbus-threads.c:227
_dbus_rmutex_unlock
DBUS_PRIVATE_EXPORT void _dbus_rmutex_unlock(DBusRMutex *mutex)
Unlocks a mutex.
Definition dbus-threads.c:153
_dbus_condvar_wait
void _dbus_condvar_wait(DBusCondVar *cond, DBusCMutex *mutex)
Atomically unlocks the mutex and waits for the conditions variable to be signalled.
Definition dbus-threads.c:243
_dbus_condvar_new_at_location
void _dbus_condvar_new_at_location(DBusCondVar **location_p)
This does the same thing as _dbus_condvar_new.
Definition dbus-threads.c:202
_dbus_cmutex_new_at_location
void _dbus_cmutex_new_at_location(DBusCMutex **location_p)
Creates a new mutex or creates a no-op mutex if threads are not initialized.
Definition dbus-threads.c:80
_dbus_condvar_wake_one
void _dbus_condvar_wake_one(DBusCondVar *cond)
If there are threads waiting on the condition variable, wake up exactly one.
Definition dbus-threads.c:281
_dbus_condvar_wait_timeout
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,...
Definition dbus-threads.c:264
_dbus_cmutex_lock
void _dbus_cmutex_lock(DBusCMutex *mutex)
Locks a mutex.
Definition dbus-threads.c:139
_dbus_cmutex_unlock
void _dbus_cmutex_unlock(DBusCMutex *mutex)
Unlocks a mutex.
Definition dbus-threads.c:167
_dbus_rmutex_free_at_location
void _dbus_rmutex_free_at_location(DBusRMutex **location_p)
Frees a DBusRMutex; does nothing if passed a NULL pointer.
Definition dbus-threads.c:97
_dbus_rmutex_lock
DBUS_PRIVATE_EXPORT void _dbus_rmutex_lock(DBusRMutex *mutex)
Locks a mutex.
Definition dbus-threads.c:125
_dbus_condvar_free
void _dbus_condvar_free(DBusCondVar *cond)
Frees a conditional variable created with dbus_condvar_new(); does nothing if passed a NULL pointer.
Definition dbus-threads.c:215
dbus_bool_t
dbus_uint32_t dbus_bool_t
A boolean, valid values are TRUE and FALSE.
Definition dbus-types.h:37
DBusCMutex
Definition dbus-sysdeps-pthread.c:55
DBusCondVar
Definition dbus-sysdeps-pthread.c:59
DBusRMutex
Definition dbus-sysdeps-pthread.c:51