Another kernel bug less:

* send_signal_etc() (among others) used team::main_thread in an unsafe way; it is
  possible for a team to be part of the team list and a group without having
  a main thread very early in its creation process.
* Replaced most occurences of team->main_thread->id with team->id since the team
  always inherits the ID of its main thread in Haiku for quite some time now.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19781 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2007-01-12 22:54:21 +00:00
parent 43792b9eed
commit b129e4cee1
3 changed files with 35 additions and 35 deletions
+4 -4
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2006, Axel Dörfler, [email protected].
* Copyright 2002-2007, Axel Dörfler, [email protected].
* Distributed under the terms of the MIT License.
*
* Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
@@ -898,7 +898,7 @@ thread_exit(void)
struct process_group *freeGroup = NULL;
struct team *team = thread->team;
struct death_entry *death = NULL;
thread_id mainParentThread = -1;
thread_id parentID = -1;
bool deleteTeam = false;
sem_id cachedDeathSem = -1;
status_t status;
@@ -991,7 +991,7 @@ thread_exit(void)
struct team *parent = team->parent;
// remember who our parent was so we can send a signal
mainParentThread = parent->main_thread->id;
parentID = parent->id;
if (death != NULL) {
// insert death entry into the parent's list
@@ -1033,7 +1033,7 @@ thread_exit(void)
if (death != NULL)
free(death);
send_signal_etc(mainParentThread, SIGCHLD, B_DO_NOT_RESCHEDULE);
send_signal_etc(parentID, SIGCHLD, B_DO_NOT_RESCHEDULE);
cachedDeathSem = -1;
}