Re: pthread_join
Re: pthread_join
- Subject: Re: pthread_join
- From: Paul Forgey <email@hidden>
- Date: Fri, 10 Sep 2004 15:13:40 -0700
You are leaking threads. You need to either detach or join them.
If you are comparing how the two options perform, it may be better to
not use the semaphore at all in the attached case and simply join the
thread.
However, if at some point you run into a case where you have an
attached thread which you know for certain has finished executing and
are finished tracking it, I think the most efficient thing to do to
release the resource at this point is to detach it. There's no reason
you can't detach an attached thread that has finished executing.
On Sep 10, 2004, at 2:17 PM, Marc Van Olmen wrote:
I implemented both techniques just to try because the 'attached'
implementation gave some trouble...
In the 'attached' implementation, my virtual memory space keeps on
growing.... after 8 hours it reach 4 GB and my program stops at
'pthread_create' with error: EAGAIN
The number of threads that are there is not growing.
The 'real memory' space is not growing... I used activity monitor to
check this information here above...
The only difference between the semaphore version is the code here
below.
I defined a macro FW_SEMAPHORE_WAIT_TECHNIQUE to switch easy between
the 2 technique's
is there something special I need to do when the Thread's ends in case
of 'attached' thread?
I read the o-reilly book pThread programming and couldn't find
anything but of course i could missed something on this.
Currently in mys code in the the Entry function
I just put it the
inCAPThread->mPThread = 0;
_______________________________________________
darwin-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwin-development
Do not post admin requests to the list. They will be ignored.