Hi ALL,
I'm developing a XULRunner Application which interacts
with Devices. At the startup of the Application i need to perform
device initialization activities and some additional activities as
well. These initialization tasks takes around 30-50 secs. I tried to
implement the device related activities in a separate thread using
nsIThread ( XPCOM One).
The following Code is used in onload event of StartupWindow.
-----------------------------------------------------------------------
const nsIThread = Components.interfaces.nsIThread;
const ThreadContractID = "@mozilla.org/thread;1";
const ThreadIfc = new Components.Constructor(ThreadContractID,
"nsIThread", "init");
function deviceInitialization()
{
// Device1 Initialization
// ....
// Device2 Initialization
// Additional Initialization
}
function onMainWindowLoad() {
var runnable = {run: deviceInitialization ,};
var th = new Thread(runnable);
// Standalone appp Initialization
}
function Thread(runable) {
var th = new ThreadIfc(runable, 0,
nsIThread.PRIORITY_HIGH,
nsIThread.SCOPE_GLOBAL,
nsIThread.STATE_UNJOINABLE);
return th;
}
-----------------------------------------------------------------------
The problem i'm facing is my application is blocking at the
startup. I doubt whether i'm using nsIThread properly or not.
Is there any way to handle this type of problem
efficiently ?.
Regarding this i googled , most blogs were saying JSEngine
Can't Perform Multi-Threaded Operations ? is it So ? Please clarify me
in this regard ?
Please help me to solve this Problem . Any Pointers would be
great !!!
Thanks in Advance.
-JanakiRam.
_______________________________________________
dev-tech-xpcom mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-xpcom