A simple example of threading and join operation.
#ifndef DEBUG
#define DEBUG
#endif
#include <stdio.h>
static unsigned count = 0;
{
public:
void run(void) {
++count;
::sleep(2);
};
};
extern "C" int main()
{
time_t now, later;
testThread *thr;
time(&now);
thr = new testThread();
delete thr;
assert(count == 1);
time(&later);
assert(later >= now + 1);
time(&now);
time(&later);
assert(later >= now + 1);
return 0;
}