D-Bus service shutdown on inactivity

Thiago Macieira thiago at kde.org
Wed Jan 13 03:40:25 PST 2010


Em Quarta-feira 13 Janeiro 2010, às 12:26:31, Marriouss escreveu:
> > 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.
> 
> That doesn't help - the watcher would be created from inside the daemon,
> the same daemon that registers/unregisters the service at
> startup/shutdown - that doesn't help in determining when there are no
> clients connected to my service.

Your daemon watches its clients. When all of the clients have disappeared, the 
daemon shuts down.

-- 
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/20100113/5548ae28/attachment.pgp 


More information about the dbus mailing list