Async DBusMessage reads using the C API
Matthew Johnson
dbus at matthew.ath.cx
Thu Nov 3 03:54:10 PST 2005
OK, I've modified my original suggestion to have
dbus_connection_read_write() which queues any outstanding methods from
the bus and they can be read using dbus_connection_pop_message(). New
patch is attached. This has all been tested.
Whats the process for getting this into a release (the end result of all
this is a package using it I want to get into Debian, which will
obviously depend on a version of dbus with the call in)
If we did want a blocking version of this call it should have a timeout
value, rather than blocking indefinitely.
Matt
--
Matthew Johnson
http://www.matthew.ath.cx/
-------------- next part --------------
--- dbus-0.50/dbus/dbus-connection.c 2005-08-26 18:34:59.000000000 +0100
+++ dbus-modified/dbus/dbus-connection.c 2005-11-03 11:36:30.000000000 +0000
@@ -3111,6 +3111,23 @@
dbus_message_get_signature (message_link->data),
connection, connection->n_incoming);
}
+/**
+ * Reads and writes pending data on the socket and
+ * queues any received messages on the incoming message
+ * queue.
+ *
+ * @param connection the connection.
+*/
+void
+dbus_connection_read_write(DBusConnection* conn)
+{
+ _dbus_connection_lock (conn);
+ _dbus_connection_do_iteration_unlocked (conn,
+ DBUS_ITERATION_DO_READING |
+ DBUS_ITERATION_DO_WRITING,
+ 0);
+ _dbus_connection_unlock (conn);
+}
/**
* Returns the first-received message from the incoming message queue,
--- dbus-0.50/dbus/dbus-connection.h 2005-06-06 19:55:22.000000000 +0100
+++ dbus-modified/dbus/dbus-connection.h 2005-11-03 11:36:51.000000000 +0000
@@ -108,6 +108,7 @@
void dbus_connection_steal_borrowed_message (DBusConnection *connection,
DBusMessage *message);
DBusMessage* dbus_connection_pop_message (DBusConnection *connection);
+void dbus_connection_read_write (DBusConnection *connection);
DBusDispatchStatus dbus_connection_get_dispatch_status (DBusConnection *connection);
DBusDispatchStatus dbus_connection_dispatch (DBusConnection *connection);
dbus_bool_t dbus_connection_has_messages_to_send (DBusConnection *connection);
More information about the dbus
mailing list