diff --git a/examples/test/fs_test.c b/examples/test/fs_test.c index ab0b64ce142acb1de51a0cad910c40294c7a4ecb..bc18a196f1cdc42da8d35f0447326f185ef33f60 100644 --- a/examples/test/fs_test.c +++ b/examples/test/fs_test.c @@ -11,18 +11,18 @@ * Date Author Notes * 2011-01-02 aozima the first version. * 2011-03-17 aozima fix some bug. + * 2011-03-18 aozima to dynamic thread. */ #include #include static rt_uint32_t stop_flag = 0; +static rt_thread_t fsrw1_thread = RT_NULL; +static rt_thread_t fsrw2_thread = RT_NULL; #define fsrw1_fn "/test1.dat" #define fsrw1_data_len 120 /* Less than 256 */ - -static struct rt_thread fsrw1_thread; -static rt_uint32_t fsrw1_stack[1024/sizeof(rt_uint32_t)]; static void fsrw1_thread_entry(void* parameter) { int fd; @@ -40,6 +40,8 @@ static void fsrw1_thread_entry(void* parameter) if( stop_flag ) { rt_kprintf("thread fsrw2 error,thread fsrw1 quit!\r\n"); + fsrw1_thread = RT_NULL; + stop_flag = 0; return; } @@ -49,6 +51,7 @@ static void fsrw1_thread_entry(void* parameter) { rt_kprintf("fsrw1 open file for write failed\n"); stop_flag = 1; + fsrw1_thread = RT_NULL; return; } @@ -67,6 +70,7 @@ static void fsrw1_thread_entry(void* parameter) { rt_kprintf("fsrw1 write data failed\n"); close(fd); + fsrw1_thread = RT_NULL; stop_flag = 1; return; } @@ -83,6 +87,7 @@ static void fsrw1_thread_entry(void* parameter) { rt_kprintf("fsrw1 open file for read failed\n"); stop_flag = 1; + fsrw1_thread = RT_NULL; return; } @@ -98,6 +103,7 @@ static void fsrw1_thread_entry(void* parameter) rt_kprintf("fsrw1 read file failed\r\n"); close(fd); stop_flag = 1; + fsrw1_thread = RT_NULL; return; } for(i=0; i