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

bb adamnt42 at gmail.com
Thu Jul 8 20:22:12 CEST 2021


On Thu, 2021-07-08 at 20:15 +0200, Benoît Minisini wrote:
> 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.
> 
Yep. For some unknown reason I was trying to come up with some kind of
else clause...

b



More information about the User mailing list