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:
parent
79ff9b7399
commit
7121ca6467
|
@ -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_DIAG(x) do {rt_kprintf x;} while(0)
|
||||||
#define LWIP_PLATFORM_ASSERT(x) { rt_kprintf(x); sys_arch_assert(__FILE__, __LINE__); }
|
#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"
|
#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)
|
sys_prot_t sys_arch_protect(void)
|
||||||
{
|
{
|
||||||
|
rt_base_t level;
|
||||||
|
|
||||||
/* disable interrupt */
|
/* 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)
|
void sys_arch_unprotect(sys_prot_t pval)
|
||||||
{
|
{
|
||||||
|
/* unlock scheduler */
|
||||||
|
rt_exit_critical();
|
||||||
|
|
||||||
/* enable interrupt */
|
/* enable interrupt */
|
||||||
rt_hw_interrupt_enable(pval);
|
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_DIAG(x) do {rt_kprintf x;} while(0)
|
||||||
#define LWIP_PLATFORM_ASSERT(x) { rt_kprintf(x); sys_arch_assert(__FILE__, __LINE__); }
|
#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"
|
#include "string.h"
|
||||||
|
|
||||||
|
|
|
@ -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)
|
sys_prot_t sys_arch_protect(void)
|
||||||
{
|
{
|
||||||
|
rt_base_t level;
|
||||||
|
|
||||||
/* disable interrupt */
|
/* 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)
|
void sys_arch_unprotect(sys_prot_t pval)
|
||||||
{
|
{
|
||||||
|
/* unlock scheduler */
|
||||||
|
rt_exit_critical();
|
||||||
|
|
||||||
/* enable interrupt */
|
/* enable interrupt */
|
||||||
rt_hw_interrupt_enable(pval);
|
rt_hw_interrupt_enable(pval);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sys_arch_assert(const char* file, int line)
|
void sys_arch_assert(const char* file, int line)
|
||||||
{
|
{
|
||||||
rt_kprintf("\nAssertion: %d in %s, thread %s\n", line, file,
|
rt_kprintf("\nAssertion: %d in %s, thread %s\n", line, file,
|
||||||
|
|
Loading…
Reference in New Issue