Insert threads at the end of the free thread list so that

the chance of getting the same thread id when allocating a
new thread is reduced.  This won't work if the application
creates a new thread for every time a thread exits, but
we're still within the allowances of POSIX.
This commit is contained in:
Daniel Eischen 2003-06-08 17:35:11 +00:00
parent 4d6f145a3b
commit f91de797ce
2 changed files with 2 additions and 2 deletions

View File

@ -2151,7 +2151,7 @@ _thr_free(struct pthread *curthread, struct pthread *thread)
else {
crit = _kse_critical_enter();
KSE_LOCK_ACQUIRE(curthread->kse, &thread_lock);
TAILQ_INSERT_HEAD(&free_threadq, thread, tle);
TAILQ_INSERT_TAIL(&free_threadq, thread, tle);
free_thread_count++;
KSE_LOCK_RELEASE(curthread->kse, &thread_lock);
_kse_critical_leave(crit);

View File

@ -2151,7 +2151,7 @@ _thr_free(struct pthread *curthread, struct pthread *thread)
else {
crit = _kse_critical_enter();
KSE_LOCK_ACQUIRE(curthread->kse, &thread_lock);
TAILQ_INSERT_HEAD(&free_threadq, thread, tle);
TAILQ_INSERT_TAIL(&free_threadq, thread, tle);
free_thread_count++;
KSE_LOCK_RELEASE(curthread->kse, &thread_lock);
_kse_critical_leave(crit);