* sem_delete_owned_sems() now grabs the team lock for a very short time, and

once only.
* Improved missing team warning.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33770 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2009-10-26 13:29:29 +00:00
parent e2ee5e5706
commit 07e9fd1d84
+10 -8
View File
@@ -373,7 +373,7 @@ delete_sem_internal(sem_id id, bool checkPermission)
if (team != NULL) if (team != NULL)
list_remove_link(&sSems[slot].u.used.team_link); list_remove_link(&sSems[slot].u.used.team_link);
else else
panic("team missing"); panic("team %ld missing", sSems[slot].u.used.owner);
RELEASE_TEAM_LOCK(); RELEASE_TEAM_LOCK();
@@ -689,16 +689,18 @@ remove_thread_from_sem(queued_thread *entry, struct sem_entry *sem)
void void
sem_delete_owned_sems(struct team* team) sem_delete_owned_sems(struct team* team)
{ {
while (true) { struct list queue;
{
InterruptsSpinLocker locker(gTeamSpinlock);
list_move_to_list(&team->sem_list, &queue);
}
while (sem_entry* sem = (sem_entry*)list_remove_head_item(&queue)) {
char* name; char* name;
{ {
InterruptsSpinLocker locker(gTeamSpinlock); InterruptsLocker locker;
sem_entry* sem = (sem_entry*)list_remove_head_item(&team->sem_list);
if (sem == NULL)
break;
GRAB_SEM_LOCK(*sem); GRAB_SEM_LOCK(*sem);
uninit_sem_locked(*sem, &name); uninit_sem_locked(*sem, &name);
} }