我在使用在Microsoft Visual Studio C++ 10所明示_beginthread一个问题: 我的代码:多线程在C _beginthread ++/CLI
void __cdecl DashThread(void * Args) // function without any class refs
{
while(1){
MessageBox::Show("work");
Sleep(5000);
}
_endthread();
}
private:
System::Void button8_Click_1(System::Object^ sender, System::EventArgs^ e) {
HANDLE HDash = (HANDLE) _beginthread(DashThread, 0, NULL);
}
和错误:
错误C3641:' DashThread':用/ clr:pure或/ clr编译的函数的无效调用约定'__cdecl':安全
错误C2664:'beginthread':无法将参数1从'void( _cdecl *)(无效*)”到 '无效(__cdecl *)(无效*)'
您似乎在使用C++/CLI。为什么不使用System.Threading框架中的类来执行多线程工作? –