From d906f5fc4b773e97a4ecccacafd37cebbb82a6db Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Mon, 28 Feb 2005 00:39:51 +0000 Subject: [PATCH] * Atomic access to team debug flags. * thread_exit_args::teamID -> original_team_id. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11505 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kernel/core/thread.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/kernel/core/thread.c b/src/kernel/core/thread.c index 554c5d1d71..8922d834f1 100644 --- a/src/kernel/core/thread.c +++ b/src/kernel/core/thread.c @@ -378,10 +378,11 @@ create_thread(const char *name, team_id teamID, thread_entry_func entry, // Debug the new thread, if the parent thread required that (see above), // or the respective global team debug flag is set. But only, if a // debugger is installed for the team. - debugNewThread - |= (team->debug_info.flags & B_TEAM_DEBUG_STOP_NEW_THREADS); + debugNewThread |= (atomic_get(&team->debug_info.flags) + & B_TEAM_DEBUG_STOP_NEW_THREADS); if (debugNewThread - && (team->debug_info.flags & B_TEAM_DEBUG_DEBUGGER_INSTALLED)) { + && (atomic_get(&team->debug_info.flags) + & B_TEAM_DEBUG_DEBUGGER_INSTALLED)) { t->debug_info.flags |= B_THREAD_DEBUG_STOP; } @@ -722,7 +723,7 @@ struct thread_exit_args { cpu_status int_state; uint32 death_stack; sem_id death_sem; - team_id teamID; + team_id original_team_id; }; @@ -771,8 +772,10 @@ thread_exit2(void *_args) args.thread->next_state = THREAD_STATE_FREE_ON_RESCHED; // notify the debugger - if (args.teamID >= 0 && args.teamID != team_get_kernel_team_id()) - user_debug_thread_deleted(args.teamID, args.thread->id); + if (args.original_team_id >= 0 + && args.original_team_id != team_get_kernel_team_id()) { + user_debug_thread_deleted(args.original_team_id, args.thread->id); + } // return the death stack and reschedule one last time put_death_stack_and_reschedule(args.death_stack); @@ -961,7 +964,7 @@ thread_exit(void) args.old_kernel_stack = thread->kernel_stack_area; args.death_stack = death_stack; args.death_sem = cachedDeathSem; - args.teamID = teamID; + args.original_team_id = teamID; // set the new kernel stack officially to the death stack, wont be really switched until // the next function is called. This bookkeeping must be done now before a context switch