Re: PR_CreateThread -> PR_DestroyThread
"Mike Moening" <[email protected]> Thu, 15 Apr 2010 14:24:01 -0500
| Newsgroups | gmane.comp.mozilla.devel.nspr |
|---|---|
| Organization | Retail Technology Solutions Inc. |
| Message-ID | <[email protected]> |
"Mike Moening" <[email protected]> wrote in message news:[email protected]... > > "Benjamin Smedberg" <[email protected]> wrote in message > news:[email protected]... >> On 4/15/10 1:56 PM, Mike Moening wrote: >>> If I use PR_CreateThread() and get back a PRThread* >>> How and where it that pointer deleted once that thread dies. >>> Seems we are missing an API: PR_DestroyThread() >> >> You should never "destroy" a thread, because it may be holding a lock or >> doing some other synchronized activity. Instead you should signal the >> thread to exit (using a monitor or other thread signalling device). The >> main thread then waits for the thread to exit by calling PR_JoinThread. >> The thread exits by returning from the thread function. >> >> --BDS > > Ok.... But seems that PR_JoinThread() doens't cleanup the PRThread* > either. > Who does? > PR_JoinThread() actually does delete it. Weird pattern.