reliable unbinding of names
Jason M. Felice
jasonf@apk.net
Sun, 15 Feb 1998 16:42:33 -0500 (EST)
On Sun, 15 Feb 1998, Paul Nader wrote:
> Hi,
>
> I have a server which binds each object it creates to the Naming Service as
> the objects are created and then blocks in the boa waiting for requests. I
> have coded the destructors for the object implementations so that they will
> automatically unbind themselves from the name server.
>
> This works fine if I call _dispose for each object instance, but if I type
> CTR-C the server simply exits without calling the destructors, hence the
> objects remain registered.
>
> Is there a "reliable" way of doing what I want. I.e ensuring that when the
> server exits the name server is cleaned up, other than restaring the name
> service between runs or deleting the hierarchy of names on start-up?.
>
> Thanks in advance, Paul.
>
Install a signal handler for SIGINT. It even works in Windoze. That will
catch Ctrl-C and Ctrl-Break, but not when the process is outright killed (
kill() in *nix and TerminateProcess() in NT). In those cases you can't do
anything.
-Eraserhead