ui-utilcpp  1.8.5
Threads.cpp

Example on how to employ "ProcessThread" threads.

// Local
#include "config.h"
// STDC++
#include <iostream>
#include <fstream>
#include <vector>
// POSIX C
// C++ Libraries
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;
t->start();
int exitCode(t->wait());
std::cout << "finished with status: " << exitCode << std::endl;
}
int main()
{
try
{
MyThread<UI::Util::ForkThread> ft;
test(&ft);
}
catch(...)
{
std::cerr << "Exception" << std::endl;
}
}