[dbus] The meaning of private?
Simon Hong
simon.hong81 at gmail.com
Thu Mar 15 00:02:35 PDT 2012
My question is started from the dbus_g_bus_get_private() in the dbus-glib
binding.
Only dbus_g_bus_get_private() needs GMainContext, dbus_g_bus_get() don't
need.
dbus_g_bus_get() returns connections that can share.
dbus_g_bus_get_private() returns connection that cannot share because this
connection binds to GMainContext.
Does my thinking is right?
Thank you for your kind reply, Pavel.
On Thu, Mar 15, 2012 at 3:50 PM, Pavel Strashkin
<pavel.strashkin at gmail.com>wrote:
> Speed, memory consumption, resource management (you don't need to care
> about lifetime - just call the function and be happy).
> In the simple single-threaded-process application you don't need to
> have multiple connections so instead of having your own global
> variable for a connection and share it between all your modules (call
> it whatever you want) you already have dbus_bus_get. In case if you
> can't share the connection for a reason, you are provided with
> dbus_bus_get_private.
>
> 2012/3/14 Simon Hong <simon.hong81 at gmail.com>:
> > Thank you Pavel,
> >
> > What is the benefit of using cached connection?
> > For speed?
> >
> > On Thu, Mar 15, 2012 at 3:22 PM, Pavel Strashkin <
> pavel.strashkin at gmail.com>
> > wrote:
> >>
> >> Hi Simon,
> >>
> >> That is not so difficult as it looks like. That is just a cache.
> >> dbus_bus_get either returns cached instance (system or session bus) or
> >> caches it and then returns. dbus_bus_get_private always returns new
> >> instance without any caching.
> >>
> >> 2012/3/14 Simon Hong <simon.hong81 at gmail.com>:
> >> > Dear folks,
> >> >
> >> > What is the meaning of the private in the "dbus_bus_get_private()"?
> >> > In the api (dbus_bus_get()) reference, it said "connection to the bus
> >> > already exists, then that connection is returned".
> >> >
> >> > How the connection is already existed??
> >> > I can't understand...
> >> >
> >> > Any explanation will be happy.
> >> >
> >> > Thank you
> >> > --
> >> > ======================================
> >> > Simon Hong
> >> > "Secret of success is consistency to purpose"
> >> >
> >> >
> >> > _______________________________________________
> >> > dbus mailing list
> >> > dbus at lists.freedesktop.org
> >> > http://lists.freedesktop.org/mailman/listinfo/dbus
> >> >
> >
> >
> >
> >
> > --
> > ======================================
> > Simon Hong
> > "Secret of success is consistency to purpose"
> >
>
--
======================================
Simon Hong
"Secret of success is consistency to purpose"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/dbus/attachments/20120315/d0d66772/attachment.htm>
More information about the dbus
mailing list