std::thread arguments
Hi, I have a method:
int filetodb(std::wstring szwf, SQLHANDLESTR *h);
I want to use it, in a thread.
std says, use thread, as:
std::thread second (bar,0); // spawn new thread that calls bar(0)
How can I do this, for my method, that uses more than one, i.e., two, parameters?
My code is:
std::thread thread = std::thread(filetodb, filesP->at(i), h);
compiler says:
Error 10 error C2248: 'std::thread::thread' : cannot access private member declared in class 'std::thread' c:\program files (x86)\microsoft visual studio 11.0\vc\include\xmemory0 606 1 ConsoleApplicationa
|
How, can I do this?
Thanks!
;)
The error is telling you that std::threads can't be copied.
This:
|
std::thread thread(filetodb, filesP->at(i), h);
|
should work fine, I think.
ah yes, I haven't done this in a while! thanks, helios!
Topic archived. No new replies allowed.