#include <cstdio>
#include <cstring>
#include <iostream>
#ifdef CCXX_NAMESPACES
using namespace std;
#endif
{
public:
Child()
{ }
void run() {
cout << "child start" << endl;
cout << "child end" << endl;
}
void final() {
}
};
{
public:
Father()
{ }
void run() {
cout << "starting child thread" << endl;
Thread::sleep(1000);
cout << "father end" << endl;
}
void final() {
memset(this,0,sizeof(*this));
}
};
int main(int argc, char* argv[])
{
cout << "starting father thread" << endl;
Father *th = new Father();
th->start();
return 0;
}
Every thread of execution in an application is created by instantiating an object of a class derived ...
Definition thread.h:1094
static void sleep(timeout_t msec)
A thread-safe sleep call.
int detach(Semaphore *start=0)
Start a new thread as "detached".
class __EXPORT Thread
Definition thread.h:112
Synchronization and threading services.