rem: && (team->debug_info.flags & B_TEAM_DEBUG_DEBUGGER_INSTALLED)) {
add: && (atomic_get(&team->debug_info.flags) & B_TEAM_DEBUG_DEBUGGER_INSTALLED)) {
context: create_thread(const char *name, team_id teamID, thread_entry_func entry,	void *args1, void *args2, int32 priority, bool kernel){	struct thread *t, *currentThread;	struct team *team;	cpu_status state;	char stack_name[B_OS_NAME_LENGTH];	status_t status;	bool abort = false;	bool debugNewThread = false;	t = create_thread_struct(name);	if (t == NULL)		return B_NO_MEMORY;	t->priority = priority == -1 ? B_NORMAL_PRIORITY : priority;	// ToDo: this could be dangerous in case someone calls resume_thread() on us	t->state = B_THREAD_SUSPENDED;	t->next_state = B_THREAD_SUSPENDED;	// init debug structure	clear_thread_debug_info(&t->debug_info, false);	snprintf(stack_name, B_OS_NAME_LENGTH, "%s_%lx_kstack", name, t->id);	t->kernel_stack_area = create_area(stack_name, (void **)&t->kernel_stack_base,		B_ANY_KERNEL_ADDRESS, KERNEL_STACK_SIZE, B_FULL_LOCK,		B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_KERNEL_STACK_AREA);	if (t->kernel_stack_area < 0) {		// we're not yet part of a team, so we can just bail out		dprintf("create_thread: error creating kernel stack!\n");		status = t->kernel_stack_area;		delete_thread_struct(t);		return status;	}	state = disable_interrupts();	GRAB_THREAD_LOCK();	// If the new thread belongs to the same team as the current thread,	// it may inherit some of the thread debug flags.	currentThread = thread_get_current_thread();	if (currentThread && currentThread->team->id == teamID) {		// inherit all user flags...		int32 debugFlags = currentThread->debug_info.flags			& B_THREAD_DEBUG_USER_FLAG_MASK;		// ... save the syscall tracing flags, unless explicitely specified		if (!(debugFlags & B_THREAD_DEBUG_SYSCALL_TRACE_CHILD_THREADS)) {			debugFlags &= ~(B_THREAD_DEBUG_PRE_SYSCALL				| B_THREAD_DEBUG_POST_SYSCALL);		}		t->debug_info.flags = debugFlags;		// stop the new thread, if desired		debugNewThread = debugFlags & B_THREAD_DEBUG_STOP_CHILD_THREADS;	}	// insert into global list	hash_insert(sThreadHash, t);	sUsedThreads++;	RELEASE_THREAD_LOCK();	GRAB_TEAM_LOCK();	// look at the team, make sure it's not being deleted	team = team_get_team_struct_locked(teamID);	if (team != NULL && team->state != TEAM_STATE_DEATH) {		// 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);		if (debugNewThread			&& (team->debug_info.flags & B_TEAM_DEBUG_DEBUGGER_INSTALLED)) {			t->debug_info.flags |= B_THREAD_DEBUG_STOP;		}		insert_thread_into_team(team, t);	} else		abort = true;	RELEASE_TEAM_LOCK();	if (abort) {		GRAB_THREAD_LOCK();		hash_remove(sThreadHash, t);		RELEASE_THREAD_LOCK();	}	restore_interrupts(state);	if (abort) {		delete_area(t->kernel_stack_area);		delete_thread_struct(t);		return B_BAD_TEAM_ID;	}	t->args1 = args1;	t->args2 = args2;	t->entry = entry;	status = t->id;	if (kernel) {		// this sets up an initial kthread stack that runs the entry		// Note: whatever function wants to set up a user stack later for this thread		// must initialize the TLS for it		arch_thread_init_kthread_stack(t, &_create_kernel_thread_kentry, &thread_kthread_entry, &thread_kthread_exit);	} else {		// create user stack		// the stack will be between USER_STACK_REGION and the main thread stack area		// (the user stack of the main thread is created in team_create_team())		t->user_stack_base = USER_STACK_REGION;		t->user_stack_size = USER_STACK_SIZE;		snprintf(stack_name, B_OS_NAME_LENGTH, "%s_%lx_stack", name, t->id);		t->user_stack_area = create_area_etc(team, stack_name,				(void **)&t->user_stack_base, B_BASE_ADDRESS,				t->user_stack_size + TLS_SIZE, B_NO_LOCK,				B_READ_AREA | B_WRITE_AREA | B_STACK_AREA);		if (t->user_stack_area < 0) {			// great, we have a fully running thread without a stack			dprintf("create_thread: unable to create user stack!\n");			status = t->user_stack_area;			kill_thread(t->id);		} else {			// now that the TLS area is allocated, initialize TLS			arch_thread_init_tls(t);		}		// copy the user entry over to the args field in the thread struct		// the function this will call will immediately switch the thread into		// user space.		arch_thread_init_kthread_stack(t, &_create_user_thread_kentry, &thread_kthread_entry, &thread_kthread_exit);	}	return status;}