Hi all,
I'm new to Boost and relativily new to C++. I'm trying to program threads on my Redhat 7.2 linux.
I have the following code:
#include <iostream>
#include
#include
struct thread_struct
{
thread_struct(int secs) : m_secs(secs) {}
void operator ()()
{
boost::xtime xt;
boost::xtime_get(&xt, boost::TIME_UTC);
xt.sec += m_secs;
boost::thread::sleep(xt);
std::cout << "Boosted!!!" << std::endl;
}
int m_secs;
};
int main (int argc, char* argv[]) {
int secs = 5;
std::cout << "Starting..." << std::endl;
thread_struct ts(secs);
boost::thread thrd(ts);
thrd.join();
}
The code compiles without any problems... But do I have link it against some library? Because I cannot link it to an
executable file. I'm new to this. So can somebody please be so kind to help me and describe the steps nessecary to run
this Thread example file...
Many Thanks,
Harm de Laat
Informatiefabriek
The Netherlands