#include "TThread.h" void *ThreadFunction(void *) { for (int i=0; i<10; i++) { TThread::CancelPoint(); TThread::Printf("%d", i); TThread::Sleep(1,0); } return NULL; } void *top(void *) { TThread::Ps(); TThread::Sleep(5,0); TThread::Kill("tf"); TThread::Sleep(1,0); TThread::Ps(); return 0; } void why() { // run the thread TThread *tf = new TThread("tf", ThreadFunction); // top thread TThread *tp = new TThread("tp", top); tf->Run(); tp->Run(); }