1 /* -*- mode: C; c-file-style: "gnu" -*- */
2 /* dbus-threads.h D-BUS threads handling
4 * Copyright (C) 2002 Red Hat Inc.
6 * Licensed under the Academic Free License version 1.2
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.
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.
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
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."
27 #ifndef DBUS_THREADS_H
28 #define DBUS_THREADS_H
30 #include <dbus/dbus-macros.h>
31 #include <dbus/dbus-types.h>
35 typedef struct DBusMutex DBusMutex;
37 typedef DBusMutex* (* DBusMutexNewFunction) (void);
38 typedef void (* DBusMutexFreeFunction) (DBusMutex *mutex);
39 typedef dbus_bool_t (* DBusMutexLockFunction) (DBusMutex *mutex);
40 typedef dbus_bool_t (* DBusMutexUnlockFunction) (DBusMutex *mutex);
44 DBUS_THREAD_FUNCTIONS_NEW_MASK = 1 << 0,
45 DBUS_THREAD_FUNCTIONS_FREE_MASK = 1 << 1,
46 DBUS_THREAD_FUNCTIONS_LOCK_MASK = 1 << 2,
47 DBUS_THREAD_FUNCTIONS_UNLOCK_MASK = 1 << 3,
49 DBUS_THREAD_FUNCTIONS_ALL_MASK = 0xf
50 } DBusThreadFunctionsMask;
56 DBusMutexNewFunction mutex_new;
57 DBusMutexFreeFunction mutex_free;
58 DBusMutexLockFunction mutex_lock;
59 DBusMutexUnlockFunction mutex_unlock;
61 void (* padding1) (void);
62 void (* padding2) (void);
63 void (* padding3) (void);
64 void (* padding4) (void);
65 void (* padding5) (void);
66 void (* padding6) (void);
67 void (* padding7) (void);
68 void (* padding8) (void);
70 } DBusThreadFunctions;
73 DBusMutex* dbus_mutex_new (void);
74 void dbus_mutex_free (DBusMutex *mutex);
75 dbus_bool_t dbus_mutex_lock (DBusMutex *mutex);
76 dbus_bool_t dbus_mutex_unlock (DBusMutex *mutex);
78 void dbus_threads_init (const DBusThreadFunctions *functions);
82 #endif /* DBUS_THREADS_H */