#include<iostream>
#include"osapi/osapi.h"
using namespace std;
class Buddhist: public OS_Thread
{
public:
private:
virtual int Routine()
{
for (int i = 0; i < 100; i++)
{
cout<< "ma ni ma ni bei bei hong !" << endl;
OS_Thread::Msleep(100);
}
return 0;
}
};
class Programmer : public OS_Thread
{
public:
private:
virtual int Routine()
{
for (int i = 0; i < 100; i++)
{
cout << "hello wordl !" << endl;
OS_Thread::Msleep(100);
}
return 0;
}
};
int main()//主线程
{
Buddhist taskMonk;
taskMonk.Run();//创建一个线程,线程入口是Routine()函数
Programmer taskPro;
taskPro.Run();//创建一个线程,线程入口是Routine()函数
cout << "---main routine is running----" << endl;
for (int i = 0; i < 100; i++)
{
cout << "hello china !" << endl;
OS_Thread::Msleep(1);
}
getchar();//让主线程暂时不要退出,等子线程运行
return 0;
}