D-Bus  1.4.10
dbus-threads.h
1 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
2 /* dbus-threads.h D-Bus threads handling
3  *
4  * Copyright (C) 2002 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  *
22  */
23 #if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
24 #error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
25 #endif
26 
27 #ifndef DBUS_THREADS_H
28 #define DBUS_THREADS_H
29 
30 #include <dbus/dbus-macros.h>
31 #include <dbus/dbus-types.h>
32 
34 
41 typedef struct DBusMutex DBusMutex;
43 typedef struct DBusCondVar DBusCondVar;
44 
46 typedef DBusMutex* (* DBusMutexNewFunction) (void);
48 typedef void (* DBusMutexFreeFunction) (DBusMutex *mutex);
53 
61 typedef DBusMutex* (* DBusRecursiveMutexNewFunction) (void);
64 typedef void (* DBusRecursiveMutexFreeFunction) (DBusMutex *mutex);
68 typedef void (* DBusRecursiveMutexLockFunction) (DBusMutex *mutex);
72 typedef void (* DBusRecursiveMutexUnlockFunction) (DBusMutex *mutex);
73 
77 typedef DBusCondVar* (* DBusCondVarNewFunction) (void);
80 typedef void (* DBusCondVarFreeFunction) (DBusCondVar *cond);
81 
92 typedef void (* DBusCondVarWaitFunction) (DBusCondVar *cond,
93  DBusMutex *mutex);
94 
102  DBusMutex *mutex,
103  int timeout_milliseconds);
108 typedef void (* DBusCondVarWakeOneFunction) (DBusCondVar *cond);
109 
114 typedef void (* DBusCondVarWakeAllFunction) (DBusCondVar *cond);
115 
121 typedef enum
122 {
123  DBUS_THREAD_FUNCTIONS_MUTEX_NEW_MASK = 1 << 0,
124  DBUS_THREAD_FUNCTIONS_MUTEX_FREE_MASK = 1 << 1,
125  DBUS_THREAD_FUNCTIONS_MUTEX_LOCK_MASK = 1 << 2,
126  DBUS_THREAD_FUNCTIONS_MUTEX_UNLOCK_MASK = 1 << 3,
127  DBUS_THREAD_FUNCTIONS_CONDVAR_NEW_MASK = 1 << 4,
128  DBUS_THREAD_FUNCTIONS_CONDVAR_FREE_MASK = 1 << 5,
129  DBUS_THREAD_FUNCTIONS_CONDVAR_WAIT_MASK = 1 << 6,
130  DBUS_THREAD_FUNCTIONS_CONDVAR_WAIT_TIMEOUT_MASK = 1 << 7,
131  DBUS_THREAD_FUNCTIONS_CONDVAR_WAKE_ONE_MASK = 1 << 8,
132  DBUS_THREAD_FUNCTIONS_CONDVAR_WAKE_ALL_MASK = 1 << 9,
133  DBUS_THREAD_FUNCTIONS_RECURSIVE_MUTEX_NEW_MASK = 1 << 10,
134  DBUS_THREAD_FUNCTIONS_RECURSIVE_MUTEX_FREE_MASK = 1 << 11,
135  DBUS_THREAD_FUNCTIONS_RECURSIVE_MUTEX_LOCK_MASK = 1 << 12,
136  DBUS_THREAD_FUNCTIONS_RECURSIVE_MUTEX_UNLOCK_MASK = 1 << 13,
137  DBUS_THREAD_FUNCTIONS_ALL_MASK = (1 << 14) - 1
139 
161 typedef struct
162 {
163  unsigned int mask;
182  void (* padding1) (void);
183  void (* padding2) (void);
184  void (* padding3) (void);
185  void (* padding4) (void);
188 
189 DBUS_EXPORT
191 DBUS_EXPORT
193 
197 
198 #endif /* DBUS_THREADS_H */