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
This commit is contained in:
mbbill@gmail.com 2011-07-08 02:04:14 +00:00
parent 79ff9b7399
commit 7121ca6467
4 changed files with 33 additions and 20 deletions

View File

@ -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"

View File

@ -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);

View File

@ -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"

View File

@ -226,18 +226,27 @@ sys_thread_t sys_thread_new(char *name, void (* thread)(void *arg), void *arg, i
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);
return;
}
void sys_arch_assert(const char* file, int line)
{
rt_kprintf("\nAssertion: %d in %s, thread %s\n", line, file,