[dbus] The meaning of private?

Pavel Strashkin pavel.strashkin at gmail.com
Wed Mar 14 23:50:08 PDT 2012


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"
>


More information about the dbus mailing list