codeman
24th March 2010, 18:50
Hello Friends,
I try today to give a thread a reference from a std::map. The thread have to fill the map but the run finction say that the reference variable are not declared in that scope ..
so the constructor looks like this
using namespace std;
....
MyThread::MyThread(map <int> &p_Map,
QObject* parent): QThread(parent)
{
}
MyThread::run()
{
//using p_Map;
}
and I try to use it in run()
is giving a reference to thread not allowed???
Or what is the best method to fill a map or a vector within a thread????
I try today to give a thread a reference from a std::map. The thread have to fill the map but the run finction say that the reference variable are not declared in that scope ..
so the constructor looks like this
using namespace std;
....
MyThread::MyThread(map <int> &p_Map,
QObject* parent): QThread(parent)
{
}
MyThread::run()
{
//using p_Map;
}
and I try to use it in run()
is giving a reference to thread not allowed???
Or what is the best method to fill a map or a vector within a thread????