understanding the g_bus_own_name_on_connection() method

Bogdan Lotko boguslaw.lotko at chello.at
Tue Jul 30 11:32:20 PDT 2013


Hello David,

Thank you for the answer and yes, I've read the documentation.
Though I still don't understand how shall I proceed to achieve my goal 
i.e. *atomic acquirement* of service name on D-Bus.

as I wrote the

id = g_bus_own_name_on_connection(...);
wait_for_handler(s)

is for me rather strange solution, beside of this it creates a time 
window where other application can register the name.
Shall I really wait for these callbacks? The documentation states 
"callbacks will be invoked after calling this function" - does it mean 
immediately after calling this function?
What I still don't have my main loop started and the decision if to 
start it depends on result of this method?

For me the simple and clean solution would be:
returns 0 - failure name already on use
returns > 0 - OK success name acquired

Thank you for your help,

regards,

Bogdan



On 7/30/2013 19:34, David Zeuthen wrote:
> Hi,
>
> Did you read the docs? They're here, FWIW
>
> https://developer.gnome.org/gio/unstable/gio-Owning-Bus-Names.html#g-bus-own-name
>
> Also, I wouldn't worry about the return value, it's just an opaque 
> identifier (that happens to be monotonically increasing - and always 
> starting at 1).
>
> Hope this helps.
>
>     David
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/dbus/attachments/20130730/a05f6273/attachment.html>


More information about the dbus mailing list