Xinus
Xinus

Reputation: 30513

How to close thread when firefox closes

I have a extension that uses multithreading using worker thread as shown here . Whenever worker thread returns value to main thread, I am updating UI and I am starting that thread again because I want to continuously execute that operation. I cannot use setInterval because inside thread is a call to C++ XPCOM component function which does socket recv blocking call and that reception may not be periodic.

Now when I close firefox, firefox window is closed but the firefox process keeps on running and consuming 99% CPU. So I always need to close that process forcefully.

How to close that process completely. Extension is in overlay like this

<overlay id="helloworldOverlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<statusbar id="status-bar">
.
.
.
</statusbar>
</overlay>

Upvotes: 1

Views: 249

Answers (1)

Peter
Peter

Reputation: 5156

Use the terminate method: https://developer.mozilla.org/En/DOM/Worker#Methods

Upvotes: 4

Related Questions