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:
parent
4d6f145a3b
commit
f91de797ce
@ -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);
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user