When interacting with the network stack using the sequential API, all operations are not handled by the calling thread, but instead are passed to the lwIP network processing (TCP/IP) thread. Inter-thread communication is used inside lwIP to ensure that at the point the API function returns, operation is either complete, or for asynchronous operations, under way.
For example, to register a timeout callback
tcpip_timeout() function can be used from client
threads to cross the thread boundary into the sequential TCP/IP thread. However,
since the actual timeout callback handler registered will be executed within the
sequential TCP/IP thread context, it can subsequently directly call the lwIP
sys_timeout() if it needs to re-schedule its