From 9e83cc1768934f9b2ca42f283487eff0b592c82b Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Wed, 18 Mar 2009 01:46:29 +0000 Subject: [PATCH] team_free_user_thread(): Unset the thread's user thread before putting it in the free list. Do that with the threads lock held. This allows other threads to freely access a thread's user thread structure while holding the threads lock. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29577 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/team.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/system/kernel/team.cpp b/src/system/kernel/team.cpp index 783e744e2e..c2358f97d4 100644 --- a/src/system/kernel/team.cpp +++ b/src/system/kernel/team.cpp @@ -2697,6 +2697,11 @@ team_free_user_thread(struct thread* thread) InterruptsSpinLocker _(gTeamSpinlock); + // detach from thread + SpinLocker threadLocker(gThreadSpinlock); + thread->user_thread = NULL; + threadLocker.Unlock(); + entry->thread = userThread; entry->next = thread->team->free_user_threads; thread->team->free_user_threads = entry;