loop: no longer requires a reader thread, it delivers directly to the device's receive queue

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21215 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Hugo Santos
2007-05-23 07:56:15 +00:00
parent a1deb55ef5
commit 969885b848
6 changed files with 52 additions and 74 deletions
@@ -551,19 +551,22 @@ down_device_interface(net_device_interface *interface)
notify_device_monitors(interface, B_DEVICE_GOING_DOWN);
thread_id reader_thread = interface->reader_thread;
if (device->module->receive_data != NULL) {
thread_id reader_thread = interface->reader_thread;
// TODO when setting the interface down, should we clear the receive queue?
// TODO when setting the interface down,
// should we clear the receive queue?
// one of the callers must hold a reference to the net_device_interface
// usually it is one of the net_interfaces.
recursive_lock_unlock(&interface->rx_lock);
// one of the callers must hold a reference to the net_device_interface
// usually it is one of the net_interfaces.
recursive_lock_unlock(&interface->rx_lock);
// make sure the reader thread is gone before shutting down the interface
status_t status;
wait_for_thread(reader_thread, &status);
// make sure the reader thread is gone before shutting down the interface
status_t status;
wait_for_thread(reader_thread, &status);
recursive_lock_lock(&interface->rx_lock);
recursive_lock_lock(&interface->rx_lock);
}
}
@@ -804,6 +807,21 @@ device_removed(net_device *device)
}
status_t
device_enqueue_buffer(net_device *device, net_buffer *buffer)
{
net_device_interface *interface = get_device_interface(device->index);
if (interface == NULL)
return ENODEV;
status_t status = fifo_enqueue_buffer(&interface->receive_queue, buffer);
put_device_interface(interface);
return status;
}
// #pragma mark -