mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-01-16 07:49:30 +08:00
1ebf7b5196
The ethernetif use semaphore netif->tx_ack to protect the local variable `struct eth_tx_msg msg` in function `ethernetif_linkoutput`. But the function could be called in multiple context: LwIP "tcpip" thread, "erx" thread(on linkup) and any user thread that call `udp_sendto`. So the global semaphore protection is not sufficient. It could only wakeup the top priority waiting thread instead of the thread that owns the `msg` and may result the `msg` next in the mailbox got destructed. So to use a `rt_completion` within the `struct eth_tx_msg` and synchronize on that. This could deal the ownership issue in an easy way.