dbus-threads.h

00001 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
00002 /* dbus-threads.h  D-Bus threads handling
00003  *
00004  * Copyright (C) 2002  Red Hat Inc.
00005  *
00006  * Licensed under the Academic Free License version 2.1
00007  * 
00008  * This program is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation; either version 2 of the License, or
00011  * (at your option) any later version.
00012  *
00013  * This program is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  * 
00018  * You should have received a copy of the GNU General Public License
00019  * along with this program; if not, write to the Free Software
00020  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00021  *
00022  */
00023 #if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
00024 #error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
00025 #endif
00026 
00027 #ifndef DBUS_THREADS_H
00028 #define DBUS_THREADS_H
00029 
00030 #include <dbus/dbus-macros.h>
00031 #include <dbus/dbus-types.h>
00032 
00033 DBUS_BEGIN_DECLS
00034 
00041 typedef struct DBusMutex DBusMutex;
00043 typedef struct DBusCondVar DBusCondVar;
00044 
00046 typedef DBusMutex*  (* DBusMutexNewFunction)    (void);
00048 typedef void        (* DBusMutexFreeFunction)   (DBusMutex *mutex);
00050 typedef dbus_bool_t (* DBusMutexLockFunction)   (DBusMutex *mutex);
00052 typedef dbus_bool_t (* DBusMutexUnlockFunction) (DBusMutex *mutex);
00053 
00061 typedef DBusMutex*  (* DBusRecursiveMutexNewFunction)    (void);
00064 typedef void        (* DBusRecursiveMutexFreeFunction)   (DBusMutex *mutex);
00068 typedef void        (* DBusRecursiveMutexLockFunction)   (DBusMutex *mutex);
00072 typedef void        (* DBusRecursiveMutexUnlockFunction) (DBusMutex *mutex);
00073 
00077 typedef DBusCondVar*  (* DBusCondVarNewFunction)         (void);
00080 typedef void          (* DBusCondVarFreeFunction)        (DBusCondVar *cond);
00081 
00092 typedef void          (* DBusCondVarWaitFunction)        (DBusCondVar *cond,
00093                                                           DBusMutex   *mutex);
00094 
00101 typedef dbus_bool_t   (* DBusCondVarWaitTimeoutFunction) (DBusCondVar *cond,
00102                                                           DBusMutex   *mutex,
00103                                                           int          timeout_milliseconds);
00108 typedef void          (* DBusCondVarWakeOneFunction) (DBusCondVar *cond);
00109 
00114 typedef void          (* DBusCondVarWakeAllFunction) (DBusCondVar *cond);
00115 
00121 typedef enum 
00122 {
00123   DBUS_THREAD_FUNCTIONS_MUTEX_NEW_MASK      = 1 << 0,
00124   DBUS_THREAD_FUNCTIONS_MUTEX_FREE_MASK     = 1 << 1,
00125   DBUS_THREAD_FUNCTIONS_MUTEX_LOCK_MASK     = 1 << 2,
00126   DBUS_THREAD_FUNCTIONS_MUTEX_UNLOCK_MASK   = 1 << 3,
00127   DBUS_THREAD_FUNCTIONS_CONDVAR_NEW_MASK    = 1 << 4,
00128   DBUS_THREAD_FUNCTIONS_CONDVAR_FREE_MASK   = 1 << 5,
00129   DBUS_THREAD_FUNCTIONS_CONDVAR_WAIT_MASK   = 1 << 6,
00130   DBUS_THREAD_FUNCTIONS_CONDVAR_WAIT_TIMEOUT_MASK   = 1 << 7,
00131   DBUS_THREAD_FUNCTIONS_CONDVAR_WAKE_ONE_MASK = 1 << 8,
00132   DBUS_THREAD_FUNCTIONS_CONDVAR_WAKE_ALL_MASK = 1 << 9,
00133   DBUS_THREAD_FUNCTIONS_RECURSIVE_MUTEX_NEW_MASK    = 1 << 10,
00134   DBUS_THREAD_FUNCTIONS_RECURSIVE_MUTEX_FREE_MASK   = 1 << 11,
00135   DBUS_THREAD_FUNCTIONS_RECURSIVE_MUTEX_LOCK_MASK   = 1 << 12,
00136   DBUS_THREAD_FUNCTIONS_RECURSIVE_MUTEX_UNLOCK_MASK = 1 << 13,
00137   DBUS_THREAD_FUNCTIONS_ALL_MASK     = (1 << 14) - 1
00138 } DBusThreadFunctionsMask;
00139 
00161 typedef struct
00162 {
00163   unsigned int mask; 
00165   DBusMutexNewFunction mutex_new; 
00166   DBusMutexFreeFunction mutex_free; 
00167   DBusMutexLockFunction mutex_lock; 
00168   DBusMutexUnlockFunction mutex_unlock; 
00170   DBusCondVarNewFunction condvar_new; 
00171   DBusCondVarFreeFunction condvar_free; 
00172   DBusCondVarWaitFunction condvar_wait; 
00173   DBusCondVarWaitTimeoutFunction condvar_wait_timeout; 
00174   DBusCondVarWakeOneFunction condvar_wake_one; 
00175   DBusCondVarWakeAllFunction condvar_wake_all; 
00177   DBusRecursiveMutexNewFunction recursive_mutex_new; 
00178   DBusRecursiveMutexFreeFunction recursive_mutex_free; 
00179   DBusRecursiveMutexLockFunction recursive_mutex_lock; 
00180   DBusRecursiveMutexUnlockFunction recursive_mutex_unlock; 
00182   void (* padding1) (void); 
00183   void (* padding2) (void); 
00184   void (* padding3) (void); 
00185   void (* padding4) (void); 
00187 } DBusThreadFunctions;
00188 
00189 dbus_bool_t  dbus_threads_init         (const DBusThreadFunctions *functions);
00190 dbus_bool_t  dbus_threads_init_default (void);
00191 
00194 DBUS_END_DECLS
00195 
00196 #endif /* DBUS_THREADS_H */

Generated on Sat Dec 6 19:43:44 2008 for D-Bus by  doxygen 1.5.1