D-Bus service shutdown on inactivity

Thiago Macieira thiago at kde.org
Tue Jan 12 08:22:09 PST 2010


Em Terça-feira 12 Janeiro 2010, às 09:48:30, Marriouss escreveu:
> Date: Mon, 11 Jan 2010 14:43:58 +0100 From: Thiago Macieira
> <thiago at kde.org> Subject: Re: D-Bus service shutdown on inactivity To:
> dbus at lists.freedesktop.org Message-ID:
> <201001111443.58340.thiago at kde.org> Content-Type: text/plain;
> charset="iso-8859-1" Em Segunda-feira 11 Janeiro 2010, ?s 14:17:39,
> 
> Marriouss escreveu:
> > > Hi all,
> > > 
> > > I've wrote a D-bus service (registered from a daemon) and I would like
> > > it to shutdown itself when no client is connected to it. How can I do
> > > that? Is there a way for my service to know how many clients are
> > > connected to it?
> > > 
> > > * I use QT D-Bus API.
> > > * At this moment I shutdown the daemon on inactivity.
> > 
> > I don't understand the question.
> > 
> > Why can't you shut down your app when you know that no more clients are
> > connected?
> > 
> > Or is your problem knowing that there are no clients connected?
> 
> I want my service to free the memory when it is not used.
> Use case:
> 	- daemon that creates the service is auto-launched by D-Bus when the first
> client connects to it - client finishes with the service
> 	- daemon should auto-close - nobody is using it
> 
> My problem: I do not know when I have clients connected to my service. I
> was hoping that D-Bus offers this functionality. If not, should I
> implement such an API into my service, something like: Client calls addRef
> when it connects and calls unref when its done?

Try using QDBusServiceWatcher 
(http://doc.trolltech.com/4.6/qdbusservicewatcher.html) in 
WatchForUnregistration mode.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Senior Product Manager - Nokia, Qt Development Frameworks
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
Url : http://lists.freedesktop.org/archives/dbus/attachments/20100112/18524160/attachment.pgp 


More information about the dbus mailing list