多线程


#include "rtos.h"//加的库
Thread thread1;//外部声明

void servo1_thread() 
{
    while (true) 
    {      
        Thread::signal_wait(0x001);
        ...      
    }
}
thread1.start(servo1_thread);

thread1.signal_set(0x001);

thread1.terminate( );

//read_thread
void read_thread()
{ 
    d = pc.getc();

}


void servo8_thread() 
{
    thread9.terminate( );
    if(Ein == 1)
    {
        pc.printf("s");
        wait(0.5);
    }
    thread9.start(read_thread);
}



posted @ 2018-11-25 20:27  ronnie14165  阅读(90)  评论(0编辑  收藏  举报