*name,void(*thread)(void *arg),void *arg,int stacksize,int prio):name参数是线程的名字;thread(arg)函数是线程的进入点;stacksize是这个线程堆栈的大小;prio是该线程的优先级。堆栈的大小和优先级已经在lwipopts.h文件中定义,因此你可以重新定义它们来定制你自己的系统。
如果你使用多线程,超时发生在合适的上下文中是很重要(尤其是在线程被创建的上下文中)。因此,sys_arch_timeouts函数将会返回一个该线程的超时结构体(这就是该函数需要放在第一位实现的原因,另外,sys.c可以简单的实现该函数通过提供单一的全局变量sys_timeouts)。一个合理的实现如下所示,有点以伪代码的形式:
struct thread_struct_wrapper {
struct thread_struct_wrapper *next;
MY_OS_THREAD_TYPE thread; // not a ptr in this example, but the actual space
struct sys_timeo *timeouts;
};
struct sys_timeouts lwip_system_timeouts = NULL; // Default timeouts list for lwIP