<br><div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">This should work, but you have to be prepared for the dispatch to happen<br>in this special dbus thread, and not in your main app thread.
i.e. your<br>filter functions and so forth will be called from whatever thread is<br>doing the dispatch() on the connection.<br><br>If you want to dispatch() in the main thread you can just read_write()<br>in the separate thread, then get_dispatch_status() and if needed tell
<br>your main thread to do the dispatch.<br><br>libdbus is fairly thread-safe but does have some quirks that need<br>fixing, for example you can have issues if you<br>dbus_connection_send()/dbus_connection_flush() in the main thread and do
<br>a blocking read_write() in another thread. (See a recent discussion on<br>this list.) This is a bug in libdbus but perhaps hard to fix.<br><br>If you use dbus *exclusively* in the separate thread you should<br>encounter no problems that I can think of. Also if you do all
<br>read_write() and send()/flush() in the separate thread and dispatch() in<br>the main thread I would not expect any problems.</blockquote><div><br>Ok, so what I'm doing (and it is working, so far) is dedicating a thread to read_write_dispatch. It always calls that, with a -1 timeout. In my main thread, I am doing send_with_response, and it is also working. The response callback registered with pending_call_set_notify is obviously run in the dispatcher's thread, but I handle that without any trouble. I don't really have much experience with multi-threaded programs or low-level sockets, but all this discussion of read_write_dispatch blocking the socket would make me think that what I'm doing shouldn't work. What is the problem with blocking sockets, and am I on the edge of hitting it?
<br></div><br></div>