Example on how to employ "ProcessThread" threads.
#include "config.h"
#include <iostream>
#include <fstream>
#include <vector>
template <typename T>
class MyThread: public T
{
private:
int run()
{
for (int i(0); i < 5; ++i)
{
std::cout << "(PID " << T::getPID() << ": blurp)..." << std::flush;
}
return(42);
}
};
{
std::cout << "Starting thread: " << std::flush;
std::cout << "finished with status: " << exitCode << std::endl;
}
int main()
{
try
{
MyThread<UI::Util::ForkThread> ft;
test(&ft);
}
catch(...)
{
std::cerr << "Exception" << std::endl;
}
}
Thread, descriptors and sockets.
Simple encapsulation for any process based threading system.
Definition: Thread.hpp:41
int wait()
Wait for this "thread", and return the process' exit status.
Definition: Thread.cpp:109
virtual void start()=0
Start fork "thread".
unsigned int nssleep(unsigned int seconds)
No Signal Seconds Sleep: Using POSIX nanosleep(2).
Definition: Time.cpp:47