network/stack: Update and add comments in down_device_interface.

The function names in the comment were not been updated in some time,
so synchronize those with how things presently look.

Also add another possible codepath, from device_removed. This one can
and is invoked from the device_reader_thread, in the case where
we get B_DEVICE_NOT_FOUND from receive_data. That is now taken care of
by having wait_for_thread return EDEADLK, we need only note it here.

Change-Id: I18320c2831dce99a34b07de862a0a5c8b4e4e98d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5311
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This commit is contained in:
Augustin Cavalier 2022-05-13 17:33:52 -04:00 committed by waddlesplash
parent d9694912a7
commit a806e3678a
1 changed files with 10 additions and 6 deletions

View File

@ -546,14 +546,17 @@ down_device_interface(net_device_interface* interface)
// Known callers are `interface_protocol_down' which gets
// here via one of the following paths:
//
// - domain_interface_control() [rx lock held, domain lock held]
// interface_set_down()
// - Interface::Control()
// Interface::SetDown()
// interface_protocol_down()
//
// - domain_interface_control() [rx lock held, domain lock held]
// remove_interface_from_domain()
// delete_interface()
// interface_set_down()
// - datalink_control()
// remove_interface()
// Interface::SetDown() etc.
//
// - device_removed()
// interface_removed_device_interface()
// remove_interface() etc.
net_device* device = interface->device;
@ -566,6 +569,7 @@ down_device_interface(net_device_interface* interface)
thread_id readerThread = interface->reader_thread;
// make sure the reader thread is gone before shutting down the interface
// (note that we may be the reader thread)
status_t status;
wait_for_thread(readerThread, &status);
}