Hello,

I'd like to make sure, that the name is not acquired and only one instance of my application is running at time. I tried to use the g_bus_own_name_on_connection() method but it seems not to be the best one for my purposes.

As I understand the description of this method, if the name is already acquired, the /|bus_acquired_handler |/will be called. My problem is that the handler will be called "sometime" later so after calling the method I have no idea if I shell proceed or not.

id = g_bus_own_name_on_connection(...);
wait_for_handler

is somehow dubious solution

Additionally it seem to be (at least logical) bug in the return value id "that can be used with g_bus_unown_name() to stop owning the name". Calling the method with G_BUS_NAME_OWNER_FLAGS_NONE flag I've started several applications and always got the return value equal 1. This flag shall inhibit the the loss of the name by other (already running) application, so the current application should not get any name, so there is no name to "stop owning" it.
Though the return value is 1 and I can call

id = g_bus_own_name_on_connection(...);
g_bus_unown_name( id ); // ???

Could somebody please
1) explain the correct usage of the method
2) tell me how to reliable (in the atomic way) achieve my goal from the 1st line

thank you for your help,

regards,

Bogdan

|//|
_______________________________________________
gtk-list mailing list
gtk-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-list

Reply via email to