From 28d139fa953c0b3bf2c66d92587e5287ec4dd5ab Mon Sep 17 00:00:00 2001 From: Robert Greenwalt <> Date: Thu, 2 Apr 2009 22:41:08 -0700 Subject: AI 144392: am: CL 144241 Stop polling dbus. Original author: rgreenwalt Automated import of CL 144392 --- core/jni/android_bluetooth_common.h | 41 ++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 16 deletions(-) (limited to 'core/jni/android_bluetooth_common.h') diff --git a/core/jni/android_bluetooth_common.h b/core/jni/android_bluetooth_common.h index c30ba22..69092dd 100644 --- a/core/jni/android_bluetooth_common.h +++ b/core/jni/android_bluetooth_common.h @@ -24,7 +24,9 @@ #include "utils/Log.h" #include +#include #include +#include #ifdef HAVE_BLUETOOTH #include @@ -45,6 +47,9 @@ namespace android { #define BTADDR_SIZE 18 // size of BT address character array (including null) +// size of the dbus event loops pollfd structure, hopefully never to be grown +#define DEFAULT_INITIAL_POLLFD_COUNT 8 + jfieldID get_field(JNIEnv *env, jclass clazz, const char *member, @@ -63,29 +68,33 @@ jfieldID get_field(JNIEnv *env, struct event_loop_native_data_t { DBusConnection *conn; - /* These variables are set in waitForAndDispatchEventNative() and are - valid only within the scope of this function. At any other time, they - are NULL. */ + + /* protects the thread */ + pthread_mutex_t thread_mutex; + pthread_t thread; + /* our comms socket */ + /* mem for the list of sockets to listen to */ + struct pollfd *pollData; + int pollMemberCount; + int pollDataSize; + /* mem for matching set of dbus watch ptrs */ + DBusWatch **watchData; + /* pair of sockets for event loop control, Reader and Writer */ + int controlFdR; + int controlFdW; + /* our vm and env Version for future env generation */ + JavaVM *vm; + int envVer; + /* reference to our java self */ jobject me; - JNIEnv *env; }; -dbus_bool_t dbus_func_args_async_valist(JNIEnv *env, - DBusConnection *conn, - int timeout_ms, - void (*reply)(DBusMessage *, void *), - void *user, - const char *path, - const char *ifc, - const char *func, - int first_arg_type, - va_list args); - dbus_bool_t dbus_func_args_async(JNIEnv *env, DBusConnection *conn, int timeout_ms, - void (*reply)(DBusMessage *, void *), + void (*reply)(DBusMessage *, void *, void *), void *user, + void *nat, const char *path, const char *ifc, const char *func, -- cgit v1.1