Bug 78730 - main loop implementations can't provide a function to wake up other threads
Summary: main loop implementations can't provide a function to wake up other threads
Status: RESOLVED MOVED
Alias: None
Product: dbus
Classification: Unclassified
Component: core (show other bugs)
Version: 1.5
Hardware: All All
: medium enhancement
Assignee: D-Bus Maintainers
QA Contact: D-Bus Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-05-15 08:18 UTC by nichel
Modified: 2018-10-12 21:17 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

Description nichel 2014-05-15 08:18:53 UTC
usage of dbus core library:
1.application use core library directory(no binding)and implement main loop myself.
2.2 threads, dbus main loop and application tasking thread.

issue: tasking thread call dbus_connection_send_with_reply_and_block(), it will drop connection lock before poll I/O fd. In this gap, is very likely to occur when there have a large data(read 2K once).
dbus main loop thread may read last block data from socket. and tasking thread will block until timeout(because nothing to read), it is a long time if use default value(25s).
Comment 1 Simon McVittie 2014-06-11 10:25:51 UTC
I do not recommend using libdbus in this configuration. GDBus is often a better choice for threaded applications. Doing all your D-Bus interactions in one thread, and "posting" events between threads, is also a reasonable approach.

I think a large part of the problem here is that libdbus' main loop abstraction does not have a way for main loop implementations to provide an equivalent of g_main_context_wakeup() that could wake up the tasking thread from its poll().

One of libdbus' design issues is that because it doesn't mandate a particular main-loop implementation like GLib does, it can't rely on things like "someone is dispatching this main context somewhere". Contrast with GDBus, which runs the actual D-Bus interactions in a worker thread that is always running, and can always be woken up by other threads.
Comment 2 Simon McVittie 2015-05-14 15:54:32 UTC
(In reply to Simon McVittie from comment #1)
> I think a large part of the problem here is that libdbus' main loop
> abstraction does not have a way for main loop implementations to provide an
> equivalent of g_main_context_wakeup() that could wake up the tasking thread
> from its poll().

Actually that's not true, it does have dbus_connection_set_wakeup_main_function(). Did you set one of those up?
Comment 3 GitLab Migration User 2018-10-12 21:17:56 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/dbus/dbus/issues/102.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.