我正在尝试在对象中创建一个线程,但是我收到一条错误消息说'&' : illegal operation on bound member function expression.
正在阅读我看到我必须使成员函数静态,但是当我这样做时我收到一条错误消息left of '.dac_ping' must have class/struct/union
这就是我正在尝试的:
class Dac
{
private:
network_com com;
HANDLE ping_thread;
DWORD dping_thread;
static DWORD WINAPI ping_loop(void* param)
{
while ( com.dac_ping() == 0)
Sleep(900);
return 1; //since this is an infinite loop, if the loop breaks, it has failed
}
public:
Dac()
{
}
~Dac()
{
}
void find_dac()
{
com.find_dac();
com.print_dac_info();
}
void connect_and_keep_alive()
{
if (com.dac_connect() == 0)
ping_thread = CreateThread (NULL , 0, ping_loop, NULL, 0, &dping_thread);
}
};