C convenience lib (was Re: Is dbus_pending_call_set_notify() thread safe?)

Daniel P. Berrange dan at berrange.com
Wed Aug 1 03:30:23 PDT 2007


On Wed, Aug 01, 2007 at 12:20:15AM -0400, Havoc Pennington wrote:
> Hi,
> 
> Fan Wu wrote:
> > I understand your concern of convenience API. But I think right now
> > there is market for easy to use, lightweight C bindings of libdbus.
> 
> I do agree btw, but I want to see someone really take this on rather 
> than feature-creeping libdbus in a haphazard way. I already feel bad 
> about most of dbus-bus.h.
> 
> I recently posted that "gbus" git repo, and the header file in there 
> shows what I think are some of the most interesting convenience features 
> to have. That sketch of an API uses GLib, but doesn't do any data 
> marshaling / type conversion stuff and really only uses GLib for the 
> main loop.
> 
> One problem is that without deciding on the main loop vs. threads 
> question, and which main loop if using a main loop, it's kind of tough 
> to make a genuinely convenient API.

If we mandated either threads  or a main loop we'd be cutting the number 
of potential users in half. The reason many people want to use the low
level C API is because they need the flexibility it gives in integrating
with their existing codebase.

> However, it's possible something like that "gbus" rough sketch could 
> just assume "there will be some main loop and someone doing dispatch" 
> and that would be good enough.
> 
> At that point perhaps it makes the most sense to cram most of the 
> convenience functionality there into libdbus itself, to avoid another 
> copy of the libdbus underpinnings (DBusString, main loop hooks, 
> dbus-sysdeps.c)
> 
> If we did this, the only extreme pain in a plain C app using no binding 
> would be setting up the main loop.

I think that would be fine - a quite common reason for wanting to use
the low level C api in an app is that you've got an existing codebase
into which you are retrofitting dbus support. The existing code may
well already have its own main loop and have no desire to replace that
with GLib's mainloop just so it can use DBus. So having a slightly
higher level DBus API for plain C apps, only requiring them to provide
a main loop would be quite useful. 

Regards,
Dan.
-- 
|=-            GPG key: http://www.berrange.com/~dan/gpgkey.txt       -=|
|=-       Perl modules: http://search.cpan.org/~danberr/              -=|
|=-           Projects: http://freshmeat.net/~danielpb/               -=|
|=-   berrange at redhat.com  -  Daniel Berrange  -  dan at berrange.com    -=|
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.freedesktop.org/archives/dbus/attachments/20070801/801f53fe/attachment.pgp 


More information about the dbus mailing list