No longer crashes when deleting "certain" interfaces (couldn't reproduce the

crash in Qemu for some reason).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20397 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2007-03-20 19:15:31 +00:00
parent 44b5d72b5a
commit 1a38ebd28b
3 changed files with 17 additions and 8 deletions
@@ -160,7 +160,7 @@ delete_interface(net_interface_private *interface)
if ((interface->flags & IFF_UP) != 0) {
// the interface is still up - we need to change that before deleting it
interface->flags &= ~IFF_UP;
interface->device_interface->module->down(interface->device_interface->device);
down_device_interface(interface->device_interface);
}
put_device_interface(interface->device_interface);
@@ -398,6 +398,20 @@ get_device_interface(const char *name)
}
void
down_device_interface(net_device_interface *interface)
{
net_device *device = interface->device;
device->flags &= ~IFF_UP;
interface->module->down(device);
// make sure the reader thread is gone before shutting down the interface
status_t status;
wait_for_thread(interface->reader_thread, &status);
}
// #pragma mark - devices