* delete_owned_ports() did not maintain the sUsedPorts variable, and thus led
to bug #4864. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33823 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -606,10 +606,25 @@ delete_owned_ports(struct team* team)
|
|||||||
list_move_to_list(&team->port_list, &queue);
|
list_move_to_list(&team->port_list, &queue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32 firstSlot = sMaxPorts;
|
||||||
|
int32 count = 0;
|
||||||
|
|
||||||
while (port_entry* port = (port_entry*)list_remove_head_item(&queue)) {
|
while (port_entry* port = (port_entry*)list_remove_head_item(&queue)) {
|
||||||
|
if (firstSlot > port->id % sMaxPorts)
|
||||||
|
firstSlot = port->id % sMaxPorts;
|
||||||
|
count++;
|
||||||
|
|
||||||
MutexLocker locker(port->lock);
|
MutexLocker locker(port->lock);
|
||||||
uninit_port_locked(*port);
|
uninit_port_locked(*port);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MutexLocker _(sPortsLock);
|
||||||
|
|
||||||
|
// update the first free slot hint in the array
|
||||||
|
if (firstSlot < sFirstFreeSlot)
|
||||||
|
sFirstFreeSlot = firstSlot;
|
||||||
|
|
||||||
|
sUsedPorts -= count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user