Originally Posted by
erotavlas
So, at the moment, the only choice is the boost library beacuse I'm only interested to parallelize the code inside a single machine not a cluster.
You can always fall back to use the C pthread library. It's not portable, but conceptually it is similar to Boost threading library.
A simple example in C++ would be:
Code:
#include <pthread.h>
#include <iostream>
class MyThread
{
public:
MyThread()
{
pthread_create(&m_tid, NULL, starter, this);
}
void run()
{
std::cout << "The thread is running." << std::endl;
}
void join()
{
pthread_join(m_tid, NULL);
}
private:
void* starter(void* arg)
{
MyThread* thread = reinterpret_cast<MyThread*>(arg);
thread->run();
return 0;
}
pthread_t m_tid;
};
int main()
{
MyThread mt;
mt.join();
}
Bookmarks