我正在为 Windows 开发一个应用程序,其中需要运行三个进程:_thread_EEG(采集)、_thread_MachineLearning(处理)、_thread_Interface(接口)。第二个过程使用第一个过程的数据,第三个过程需要第二个过程的结果。
class uMotor{
private:
long _endTime;
bool _busyBuffer;
bool _busyLabel;
Raw _Shared_buffer;
char _Shared_label ;
uEEG _gtec;
Interface _screen;
void _EEG (long endTime);
void _MachineLearning(long endTime);
void _Interface (long endTime);
DWORD __stdcall _Thread_EEG(LPVOID arg){
uMotor *yc_ptr = (uMotor*)arg;
yc_ptr->_EEG(_endTime);
return 1;
}
DWORD __stdcall _Thread_MachineLearning(LPVOID arg){
uMotor *yc_ptr = (uMotor*)arg;
yc_ptr->_MachineLearning(_endTime);
return 1;
}
DWORD __stdcall _Thread_Interface(LPVOID arg){
uMotor *yc_ptr = (uMotor*)arg;
yc_ptr->_Interface(_endTime);
return 1;
}
public:
uMotor();
void BCI();
~uMotor();
};
线程在函数中调用uMotor::BCI()
:
void uMotor::BCI(){
const long NUM_SECONDS_RUNNING = 9;
long startTime = clock();
long endTime = startTime + NUM_SECONDS_RUNNING * CLOCKS_PER_SEC;
HANDLE Handle_Thread_EEG = 0;
HANDLE Handle_Thread_MachineLearning = 0;
HANDLE Handle_Thread_Interface = 0;
Handle_Thread_EEG = CreateThread(NULL, 0, _Thread_EEG, &endTime, 0, NULL);
Handle_Thread_EEG = CreateThread(NULL, 0, _Thread_MachineLearning, &endTime, 0, NULL);
Handle_Thread_EEG = CreateThread(NULL, 0, _Thread_Interface, &endTime, 0, NULL);
}
在函数CreateThread
中,Visual Studio 2015 显示错误argument of type "DWORD(_stdcall uMotor::*)(LPVOID arg)" is incompatible with parameter of type "LPTHREAD_START_ROUTINE"
我究竟做错了什么?