Hi all:

    I am getting a crash while using nsiThread. I have copied my code snippet 
here which creates threads. If I comment out the thread creation part and call 
the run function directly, then the crash never happens. Can somebody please 
point out what is going wrong here?
    Please not that I call the CreateHandler function repeatedly. Also note 
that my mozilla build is Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; 
rv:1.8.1b1)

function Handler()
{
  this.mThread = new Thread;
  this.mThread.init(this, 0, nsIThread.PRIORITY_LOW, nsIThread.SCOPE_GLOBAL, 
nsIThread.STATE_UNJOINABLE);
}

Handler.prototype = 
{
  run: function Handler_run() { this.Run(); },
  Run: function Handler_Run() 
  {
    //doing nothing
  }
}


function Creator() 
{
  this.cH=[];
};

Creator.prototype  =
{
  QueryInterface: function Creator_QueryInterface(iid)
  {
    if (!iid.equals(nsIObserver) &&
        !iid.equals(nsIServerSocketListener) &&
        !iid.equals(nsISupports))
      throw Components.results.NS_ERROR_NO_INTERFACE;
    return this;
  },

  CreateHandler: function Creator_ CreateHandler()
  {
        for(var h=0;h<20;h++)
            this.cH.push(new Handler());
  }
}


-- 
Best Regards.
Umesh.
_______________________________________________
dev-tech-xpcom mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-xpcom

Reply via email to