I've written a windowless NPAPI plugin, and I am going to perform some long lasting operation (e.g.send a http post request with image data) in a plugin function called by web browser JavaScript.
To prevent web browser from hanging, I create one worker thread for every lengthy operation.
My question is that if the browser is closed while there are still worker threads running, how can I prevent my plugin instance from being destroyed (in NPP_Destroy?) before worker threads completed?
For ActiveX control, I simply add/release plugin instance's reference count every time the worker thread is launched/completed. But for NPAPI plugin, the reference count is just for NPObject(created via NPN_CreateObject) instead of plugin instance itself. Now I get baffled.
Any help would be really appreciated.