[Gambas-user] gambas | Draft: DBus, add ConnectionExists boolean property (!238)

Benoît Minisini g4mba5 at gmail.com
Thu Jul 8 20:15:06 CEST 2021

Le 08/07/2021 à 20:08, bb a écrit :
> Bruce,
> It's not the connection that is failing. It is the attempted
> registration.
>>From memory, checking whether a (any) dbus server already exists can be
> done by simply trying to connect to it. BUT! as Benoit said, that is
> not a "atomic" process.
> The way he described is the best way to do such a "set and test" check.
> 	try(set registration)
> 	except (set error)
> 	on_error(do something)
> 	else (do something else, like attempt to "become" the server*)

This is not necessary to "attempt to become the server", because this is 
what is already done by the DBus registration process.

Once registered, you are "de facto" the unique "server" process. DBus 
gives you the atomicity.

Benoît Minisini

More information about the User mailing list