My question is started from the dbus_g_bus_get_private() in the dbus-glib binding.<div><br></div><div>Only dbus_g_bus_get_private() needs GMainContext, dbus_g_bus_get() don't need.</div><div>dbus_g_bus_get() returns connections that can share.</div>
<div>dbus_g_bus_get_private() returns connection that cannot share because this connection binds to GMainContext.</div><div><br></div><div>Does my thinking is right?</div><div><br></div><div>Thank you for your kind reply, Pavel.</div>
<div><br><div class="gmail_quote">On Thu, Mar 15, 2012 at 3:50 PM, Pavel Strashkin <span dir="ltr"><<a href="mailto:pavel.strashkin@gmail.com">pavel.strashkin@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Speed, memory consumption, resource management (you don't need to care<br>
about lifetime - just call the function and be happy).<br>
In the simple single-threaded-process application you don't need to<br>
have multiple connections so instead of having your own global<br>
variable for a connection and share it between all your modules (call<br>
it whatever you want) you already have dbus_bus_get. In case if you<br>
can't share the connection for a reason, you are provided with<br>
dbus_bus_get_private.<br>
<br>
2012/3/14 Simon Hong <<a href="mailto:simon.hong81@gmail.com">simon.hong81@gmail.com</a>>:<br>
<div class="HOEnZb"><div class="h5">> Thank you Pavel,<br>
><br>
> What is the benefit of using cached connection?<br>
> For speed?<br>
><br>
> On Thu, Mar 15, 2012 at 3:22 PM, Pavel Strashkin <<a href="mailto:pavel.strashkin@gmail.com">pavel.strashkin@gmail.com</a>><br>
> wrote:<br>
>><br>
>> Hi Simon,<br>
>><br>
>> That is not so difficult as it looks like. That is just a cache.<br>
>> dbus_bus_get either returns cached instance (system or session bus) or<br>
>> caches it and then returns. dbus_bus_get_private always returns new<br>
>> instance without any caching.<br>
>><br>
>> 2012/3/14 Simon Hong <<a href="mailto:simon.hong81@gmail.com">simon.hong81@gmail.com</a>>:<br>
>> > Dear folks,<br>
>> ><br>
>> > What is the meaning of the private in the "dbus_bus_get_private()"?<br>
>> > In the api (dbus_bus_get()) reference, it said "connection to the bus<br>
>> > already exists, then that connection is returned".<br>
>> ><br>
>> > How the connection is already existed??<br>
>> > I can't understand...<br>
>> ><br>
>> > Any explanation will be happy.<br>
>> ><br>
>> > Thank you<br>
>> > --<br>
>> > ======================================<br>
>> > Simon Hong<br>
>> > "Secret of success is consistency to purpose"<br>
>> ><br>
>> ><br>
>> > _______________________________________________<br>
>> > dbus mailing list<br>
>> > <a href="mailto:dbus@lists.freedesktop.org">dbus@lists.freedesktop.org</a><br>
>> > <a href="http://lists.freedesktop.org/mailman/listinfo/dbus" target="_blank">http://lists.freedesktop.org/mailman/listinfo/dbus</a><br>
>> ><br>
><br>
><br>
><br>
><br>
> --<br>
> ======================================<br>
> Simon Hong<br>
> "Secret of success is consistency to purpose"<br>
><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>======================================<div>Simon Hong</div><div>"Secret of success is consistency to purpose"</div><br>
</div>