I am developing an application for Windows in Visual Studio 2015.
The application runs three parallel processes: _thread_EEG (acquisition), _thread_MachineLearning (processing), _thread_Interface (interface).
I'm using the libraries: <thread>
<mutex>
class uMotor{
private:
// Shared memory status
std::mutex _Mutex_Buffer;
std::mutex _Mutex_Label ;
// Shared memory
Raw _Shared_buffer;
char _Shared_label ;
long _endTime;
void _EEG ();
void _ML ();
void _Interface ();
static void _Thread_EEG(void *args){
uMotor *prunnable = static_cast<uMotor*>(args);
prunnable->_EEG();
}
static void _Thread_ML(void *args){
uMotor *prunnable = static_cast<uMotor*>(args);
prunnable->_ML();
}
static void _Thread_Interface(void *args){
uMotor *prunnable = static_cast<uMotor*>(args);
prunnable->_Interface();
}
/*
...
*/
}
The threads are called in function uMotor::BCI()
:
void uMotor::BCI(){
const long NUM_SECONDS_RUNNING = 20;
long startTime = clock();
_endTime = startTime + NUM_SECONDS_RUNNING * CLOCKS_PER_SEC;
// Create threads
std::thread std_Thread_EEG (_Thread_EEG );
std::thread std_Thread_Interface(_Thread_Interface);
std::thread std_Thread_ML (_Thread_ML );
std_Thread_EEG .join();
std_Thread_Interface.join();
std_Thread_ML .join();
}
This code looks fine in the IDE (Visual Studio 2015) but when I try to compile it, I get the following errors:
Error C2672 'std::invoke': no matching overloaded function found uMotor c:\program files (x86)\microsoft visual studio 14.0\vc\include\thr\xthread 240
Error C2893 Failed to specialize function template 'unknown-type std::invoke(_Callable &&,_Types &&...)' uMotor c:\program files (x86)\microsoft visual studio 14.0\vc\include\thr\xthread 240
What am I doing wrong?