update thread delete example.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@534 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
bernard.xiong 2010-03-24 09:48:59 +00:00
parent 781fd25bc9
commit 31561ae50a
1 changed files with 5 additions and 3 deletions

View File

@ -1,7 +1,7 @@
/* /*
* 线 * 线
* *
* 线线线 * 线线线
*/ */
#include <rtthread.h> #include <rtthread.h>
#include "tc_comm.h" #include "tc_comm.h"
@ -37,6 +37,7 @@ static void thread2_entry(void* parameter)
* *
*/ */
rt_thread_delete(tid1); rt_thread_delete(tid1);
tid1 = RT_NULL;
/* /*
* 线210OS Tick然后退出线2idle线程 * 线210OS Tick然后退出线2idle线程
@ -48,6 +49,7 @@ static void thread2_entry(void* parameter)
* 线2(线线idle线 * 线2(线线idle线
* ) * )
*/ */
tid2 = RT_NULL;
} }
/* 线程删除示例的初始化 */ /* 线程删除示例的初始化 */
@ -55,7 +57,7 @@ int thread_delete_init()
{ {
/* 创建线程1 */ /* 创建线程1 */
tid1 = rt_thread_create("t1", /* 线程1的名称是t1 */ tid1 = rt_thread_create("t1", /* 线程1的名称是t1 */
thread1_entry, RT_NULL, /* 入口thread1_entry参数是RT_NULL */ thread1_entry, RT_NULL, /* 入口thread1_entry参数是RT_NULL */
THREAD_STACK_SIZE, THREAD_PRIORITY, THREAD_TIMESLICE); THREAD_STACK_SIZE, THREAD_PRIORITY, THREAD_TIMESLICE);
if (tid1 != RT_NULL) /* 如果获得线程控制块,启动这个线程 */ if (tid1 != RT_NULL) /* 如果获得线程控制块,启动这个线程 */
rt_thread_startup(tid1); rt_thread_startup(tid1);
@ -64,7 +66,7 @@ int thread_delete_init()
/* 创建线程1 */ /* 创建线程1 */
tid2 = rt_thread_create("t2", /* 线程1的名称是t2 */ tid2 = rt_thread_create("t2", /* 线程1的名称是t2 */
thread2_entry, RT_NULL, /* 入口thread2_entry参数是RT_NULL */ thread2_entry, RT_NULL, /* 入口thread2_entry参数是RT_NULL */
THREAD_STACK_SIZE, THREAD_PRIORITY - 1, THREAD_TIMESLICE); THREAD_STACK_SIZE, THREAD_PRIORITY - 1, THREAD_TIMESLICE);
if (tid2 != RT_NULL) /* 如果获得线程控制块,启动这个线程 */ if (tid2 != RT_NULL) /* 如果获得线程控制块,启动这个线程 */
rt_thread_startup(tid2); rt_thread_startup(tid2);