提交 7121ca64 编写于 作者: M mbbill@gmail.com

fixd a critical issue in lwip. see issue#11

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1621 bbd45198-f89e-11dd-88c7-29a3b14d5316
上级 79ff9b73
......@@ -92,9 +92,6 @@ void sys_arch_assert(const char* file, int line);
#define LWIP_PLATFORM_DIAG(x) do {rt_kprintf x;} while(0)
#define LWIP_PLATFORM_ASSERT(x) { rt_kprintf(x); sys_arch_assert(__FILE__, __LINE__); }
#define SYS_ARCH_DECL_PROTECT(x)
#define SYS_ARCH_PROTECT(x)
#define SYS_ARCH_UNPROTECT(x)
#include "string.h"
......
......@@ -491,12 +491,22 @@ sys_thread_t sys_thread_new(const char *name, lwip_thread_fn thread, void *arg,
sys_prot_t sys_arch_protect(void)
{
rt_base_t level;
/* disable interrupt */
return rt_hw_interrupt_disable();
level = rt_hw_interrupt_disable();
/* must also lock scheduler */
rt_enter_critical();
return level;
}
void sys_arch_unprotect(sys_prot_t pval)
{
/* unlock scheduler */
rt_exit_critical();
/* enable interrupt */
rt_hw_interrupt_enable(pval);
......
......@@ -92,9 +92,6 @@ void sys_arch_assert(const char* file, int line);
#define LWIP_PLATFORM_DIAG(x) do {rt_kprintf x;} while(0)
#define LWIP_PLATFORM_ASSERT(x) { rt_kprintf(x); sys_arch_assert(__FILE__, __LINE__); }
#define SYS_ARCH_DECL_PROTECT(x)
#define SYS_ARCH_PROTECT(x)
#define SYS_ARCH_UNPROTECT(x)
#include "string.h"
......
......@@ -224,20 +224,29 @@ sys_thread_t sys_thread_new(char *name, void (* thread)(void *arg), void *arg, i
return t;
}
sys_prot_t sys_arch_protect(void)
{
/* disable interrupt */
return rt_hw_interrupt_disable();
sys_prot_t sys_arch_protect(void)
{
rt_base_t level;
/* disable interrupt */
level = rt_hw_interrupt_disable();
/* must also lock scheduler */
rt_enter_critical();
return level;
}
void sys_arch_unprotect(sys_prot_t pval)
{
/* unlock scheduler */
rt_exit_critical();
/* enable interrupt */
rt_hw_interrupt_enable(pval);
return;
}
void sys_arch_unprotect(sys_prot_t pval)
{
/* enable interrupt */
rt_hw_interrupt_enable(pval);
return;
}
void sys_arch_assert(const char* file, int line)
{
rt_kprintf("\nAssertion: %d in %s, thread %s\n", line, file,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册