Thanks for your response, I am new to XPCOM dev and could not find any good documentation for the methods in nsIThread. So what I want to do is create a background thread from the UI thread and start it and let it run to completion without joining or interrupting it. In that case do I just set the PRThreadState to STATE_UNJOINABLE and not call the Join ?
-Sandip On 6/7/06, Christian Biesinger <[EMAIL PROTECTED]> wrote:
[EMAIL PROTECTED] wrote: > For the second question, the PRThreadState needs to be set to > STATE_UNJOINABLE if you wish to have the main thread return control > after starting the worker thread. Err, that is quite wrong. It looks like you misunderstood the purpose of the Join() function. The entire point of it is to block the current thread until the other thread is finished. Therefore, it makes little sense to call it immediately after thread creation. The reason it works now is that you can't join an unjoinable thread, so the call does nothing, and probably returns an error. Note that you do have to call Join() at some point if you create a joinable thread, otherwise you leak memory. But you should do it "later" (when exactly depends on what the thread does...) -christian
_______________________________________________ dev-tech-xpcom mailing list [email protected] https://lists.mozilla.org/listinfo/dev-tech-xpcom
