Main Page | Modules | Namespace List | Class Hierarchy | Data Structures | Directories | File List | Namespace Members | Data Fields | Related Pages

dbus-threads.h

00001 /* -*- mode: C; c-file-style: "gnu" -*- */
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 
00035 typedef struct DBusMutex DBusMutex;
00036 typedef struct DBusCondVar DBusCondVar;
00037 
00038 typedef DBusMutex*  (* DBusMutexNewFunction)    (void);
00039 typedef void        (* DBusMutexFreeFunction)   (DBusMutex *mutex);
00040 typedef dbus_bool_t (* DBusMutexLockFunction)   (DBusMutex *mutex);
00041 typedef dbus_bool_t (* DBusMutexUnlockFunction) (DBusMutex *mutex);
00042 
00043 typedef DBusCondVar*  (* DBusCondVarNewFunction)         (void);
00044 typedef void          (* DBusCondVarFreeFunction)        (DBusCondVar *cond);
00045 typedef void          (* DBusCondVarWaitFunction)        (DBusCondVar *cond,
00046                                                           DBusMutex   *mutex);
00047 typedef dbus_bool_t   (* DBusCondVarWaitTimeoutFunction) (DBusCondVar *cond,
00048                                                           DBusMutex   *mutex,
00049                                                           int          timeout_milliseconds);
00050 typedef void          (* DBusCondVarWakeOneFunction) (DBusCondVar *cond);
00051 typedef void          (* DBusCondVarWakeAllFunction) (DBusCondVar *cond);
00052 
00053 typedef enum 
00054 {
00055   DBUS_THREAD_FUNCTIONS_MUTEX_NEW_MASK      = 1 << 0,
00056   DBUS_THREAD_FUNCTIONS_MUTEX_FREE_MASK     = 1 << 1,
00057   DBUS_THREAD_FUNCTIONS_MUTEX_LOCK_MASK     = 1 << 2,
00058   DBUS_THREAD_FUNCTIONS_MUTEX_UNLOCK_MASK   = 1 << 3,
00059   DBUS_THREAD_FUNCTIONS_CONDVAR_NEW_MASK    = 1 << 4,
00060   DBUS_THREAD_FUNCTIONS_CONDVAR_FREE_MASK   = 1 << 5,
00061   DBUS_THREAD_FUNCTIONS_CONDVAR_WAIT_MASK   = 1 << 6,
00062   DBUS_THREAD_FUNCTIONS_CONDVAR_WAIT_TIMEOUT_MASK   = 1 << 7,
00063   DBUS_THREAD_FUNCTIONS_CONDVAR_WAKE_ONE_MASK = 1 << 8,
00064   DBUS_THREAD_FUNCTIONS_CONDVAR_WAKE_ALL_MASK = 1 << 9,
00065 
00066   DBUS_THREAD_FUNCTIONS_ALL_MASK     = (1 << 10) - 1
00067 } DBusThreadFunctionsMask;
00068 
00073 typedef struct
00074 {
00075   unsigned int mask; 
00077   DBusMutexNewFunction mutex_new; 
00078   DBusMutexFreeFunction mutex_free; 
00079   DBusMutexLockFunction mutex_lock; 
00080   DBusMutexUnlockFunction mutex_unlock; 
00082   DBusCondVarNewFunction condvar_new; 
00083   DBusCondVarFreeFunction condvar_free; 
00084   DBusCondVarWaitFunction condvar_wait; 
00085   DBusCondVarWaitTimeoutFunction condvar_wait_timeout; 
00086   DBusCondVarWakeOneFunction condvar_wake_one; 
00087   DBusCondVarWakeAllFunction condvar_wake_all; 
00089   void (* padding1) (void); 
00090   void (* padding2) (void); 
00091   void (* padding3) (void); 
00092   void (* padding4) (void); 
00093   void (* padding5) (void); 
00094   void (* padding6) (void); 
00095   void (* padding7) (void); 
00096   void (* padding8) (void); 
00098 } DBusThreadFunctions;
00099 
00100 dbus_bool_t  dbus_threads_init         (const DBusThreadFunctions *functions);
00101 
00102 DBUS_END_DECLS
00103 
00104 #endif /* DBUS_THREADS_H */

Generated on Tue Sep 13 01:28:07 2005 for D-BUS by  doxygen 1.4.4