mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-09-25 06:13:56 +08:00
[components][net] 1.网卡可卸载 2.dhcpd 服务可停止
This commit is contained in:
@@ -350,6 +350,37 @@ static void sal_unlock(void)
|
||||
rt_mutex_release(&sal_core_lock);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will clean the netdev.
|
||||
*
|
||||
* @note please don't invoke it on ISR.
|
||||
*/
|
||||
int sal_netdev_cleanup(struct netdev *netdev)
|
||||
{
|
||||
int idx = 0, find_dev;
|
||||
|
||||
do
|
||||
{
|
||||
find_dev = 0;
|
||||
sal_lock();
|
||||
for (idx = 0; idx < socket_table.max_socket; idx++)
|
||||
{
|
||||
if (socket_table.sockets[idx] && socket_table.sockets[idx]->netdev == netdev)
|
||||
{
|
||||
find_dev = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
sal_unlock();
|
||||
if (find_dev)
|
||||
{
|
||||
rt_thread_mdelay(rt_tick_from_millisecond(100));
|
||||
}
|
||||
} while (find_dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will initialize sal socket object and set socket options
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user