Я пытаюсь создать поток в Visual C++, но получаю эту ошибку
invalid delegate initializer -- function does not match the delegate type
и это применяется к тому месту, где я передаю свой метод в поток.
COM_Selector^ port;
Thread^ t;
public: void thread_method(Object^ data) {
port->checkConnection(t);
}
private: System::Void MyForm_Load(System::Object^ sender, System::EventArgs^ e) {
t = gcnew Thread(gcnew ThreadStart(this, thread_method));
try {
if (!t->IsAlive) {
t->IsBackground = true;
t->Start();
}
else {
t->IsBackground = true;
}
}
catch (Exception^ ex) {
Console::WriteLine(ex);
}
}
```