I take it that we can now "join" this thread - effectively terminating it!

Isaac Aaron wrote:
> --=_IS_MIME_Boundary
> Content-Type: text/plain; charset=us-ascii
> Content-Transfer-Encoding: 7bit
> 
> ----------------------------------------- (on server-express.q-bytes.com)
> 
> This mail was scanned by Trend Micro InterScan VirusWall when leaving Quality Bytes
> 
> ---------------------------------------------------------
> 
> --=_IS_MIME_Boundary
> Content-Type: text/plain;
>       charset="us-ascii"
> Content-Transfer-Encoding: 7bit
> 
> Sorry for the disclaimer, will do something about it.
> 
> The problem was that I didn't pthread_detach the thread, and since I didn't
> do that nor did I join the thread, pth didn't free it's resources.
> The thing is, I Read the F Manual (over and over, even considered trying
> mit-pthreads instead), did didn't think that I WANT to detach the thread?
> (Why detach? I kind of like it... Better keep it).
> 
> Thanks everyone.
> Isaac Aaron
> 
> 
>>-----Original Message-----
>>From: [EMAIL PROTECTED]
>>[mailto:[EMAIL PROTECTED]]On Behalf Of Daniel Feiglin
>>Sent: Thursday, March 14, 2002 12:24 PM
>>To: Nadav Har'El
>>Cc: Isaac Aaron; [EMAIL PROTECTED]
>>Subject: Re: pthreads question
>>
>>
>>
>>
>>Nadav Har'El wrote:
>>
>>>On Thu, Mar 14, 2002, Isaac Aaron wrote about "pthreads question":
>>>
>>>
>>>>----------------------------------------- (on
>>>>
>>server-express.q-bytes.com)
>>
>>>>This mail was scanned by Trend Micro InterScan VirusWall when
>>>>
>>leaving Quality Bytes
>>
>>>Agggh!!! What an ugly mailer you're using :(
>>>
>>>
>>>
>>>>This is my example of pthread not releasing memory resources
>>>>
>>when the thread
>>
>>>>function exits (I would REALLY like to have that memory back).
>>>>
>>>>
>>>Please read the manuals of pthread_detach() and maybe pthread_join().
>>>Hopefully that would fix your problem.
>>>
>>>
>>>
>>1. I ran up the example and could not reproduce the problem. After the
>>programe/threads exited, all virtual memory was returned.
>>Probably, usleep() was
>>not honoured on my system (PII 266 MHz) as documented.
>>2. Threads under Linux are implemented as processes, so that if
>>they don't show
>>up any more under ps, they're really gone.
>>3. According to the GNU C library documentation, if you fail to join to a
>>joinable thread, as a result of the parent prematurely dying, you
>>should get the
>>results you saw. Because the threads are Linux processes, they
>>are zombies,
>>which show up as unterminated processes, but don't actually hold
>>real resources.
>>4. pthread_detach merely runs the threads (under Linux) as independent
>>processes, which always return their virtual memory on termination.
>>
>>So, checkout pthread_join and maybe pthread_detach!
>>
>>Regards,
>>
>>DAF
>>
>>
>>=================================================================
>>To unsubscribe, send mail to [EMAIL PROTECTED] with
>>the word "unsubscribe" in the message body, e.g., run the command
>>echo unsubscribe | mail [EMAIL PROTECTED]
>>
> 
> --=_IS_MIME_Boundary--
> 
> =================================================================
> To unsubscribe, send mail to [EMAIL PROTECTED] with
> the word "unsubscribe" in the message body, e.g., run the command
> echo unsubscribe | mail [EMAIL PROTECTED]
> 
> 
> 



=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]

Reply via email to