Your xpcom component should implement the nsIObserver interface and observe the shutdown event which is fired.

There are some of examples in lxr:

http://lxr.mozilla.org/seamonkey/search?string=xpcom-shutdown

Doug

Ramin Dousti wrote:
Hi all,

I have an application with several xpcom components which are all:

class xpABC: virtual public nsIRunnable {
 volatile bool m_bQuit;             // Quit state.

 ...
}

NS_IMETHODIMP xpABC::Run() {
  ...
  do {
     ...
  } while (!m_bQuit);
  syslog("quiting...");
  do_cleanup();
}


My question is, once the DLL has been loaded how can I access xpABC::m_bQuit from my main thread and set it to true so that the component stops.

If I do a NS_ShutdownXPCOM(nsnull) in my main thread, the components stop
with error messages like:

1[2bd38]: nsNativeComponentLoader: nsIModule::CanUnload() returned error for /path/to/components/libxpABC.so

The reason I want to be able to break the infinite loop on my Run() is that
I have some cleanup to do before terminating.


Any help or suggestion is welcome.


Thanks,
Ramin



_______________________________________________
Mozilla-xpcom mailing list
[EMAIL PROTECTED]
http://mail.mozilla.org/listinfo/mozilla-xpcom

Reply via email to