diff options
| author | bernard <[email protected]> | 2017-11-15 11:18:56 +0800 |
|---|---|---|
| committer | bernard <[email protected]> | 2017-11-15 11:18:56 +0800 |
| commit | 8013d5f7686f595e48fe3025a34f0f1ba9a65181 (patch) | |
| tree | edfdd41b5c851554f6543bb4df81d69d663b1be2 /components/net | |
| parent | e4c237d58b4f96cfd16ab46b0a073558018d9a00 (diff) | |
[lwIP] add lock for init_done callback.
Diffstat (limited to 'components/net')
| -rw-r--r-- | components/net/lwip-1.4.1/src/arch/sys_arch.c | 3 | ||||
| -rw-r--r-- | components/net/lwip-2.0.2/src/arch/sys_arch.c | 3 |
2 files changed, 6 insertions, 0 deletions
diff --git a/components/net/lwip-1.4.1/src/arch/sys_arch.c b/components/net/lwip-1.4.1/src/arch/sys_arch.c index 14e61fb88f..3ae6360198 100644 --- a/components/net/lwip-1.4.1/src/arch/sys_arch.c +++ b/components/net/lwip-1.4.1/src/arch/sys_arch.c @@ -11,6 +11,7 @@ * Date Author Notes * 2012-12-8 Bernard add file header * export bsd socket symbol for RT-Thread Application Module + * 2017-11-15 Bernard add lock for init_done callback. */ #include <rtthread.h> @@ -96,6 +97,7 @@ static void tcpip_init_done_callback(void *arg) /* leave critical */ rt_exit_critical(); + LOCK_TCPIP_CORE(); netif_add(ethif->netif, &ipaddr, &netmask, &gw, ethif, netif_device_init, tcpip_input); @@ -121,6 +123,7 @@ static void tcpip_init_done_callback(void *arg) netif_set_link_up(ethif->netif); } + UNLOCK_TCPIP_CORE(); /* enter critical */ rt_enter_critical(); } diff --git a/components/net/lwip-2.0.2/src/arch/sys_arch.c b/components/net/lwip-2.0.2/src/arch/sys_arch.c index dd5345ccbb..d0862000ad 100644 --- a/components/net/lwip-2.0.2/src/arch/sys_arch.c +++ b/components/net/lwip-2.0.2/src/arch/sys_arch.c @@ -11,6 +11,7 @@ * Date Author Notes * 2012-12-8 Bernard add file header * export bsd socket symbol for RT-Thread Application Module + * 2017-11-15 Bernard add lock for init_done callback. */ #include <rtthread.h> @@ -98,6 +99,7 @@ static void tcpip_init_done_callback(void *arg) /* leave critical */ rt_exit_critical(); + LOCK_TCPIP_CORE(); netif_add(ethif->netif, &ipaddr, &netmask, &gw, ethif, netif_device_init, tcpip_input); @@ -120,6 +122,7 @@ static void tcpip_init_done_callback(void *arg) netif_set_link_up(ethif->netif); } + UNLOCK_TCPIP_CORE(); /* enter critical */ rt_enter_critical(); } |
