c++中使用类成员函数做为线程函数

typedef unsigned (__stdcall   CAdapterObj::* Fun )( void  );
 typedef unsigned (__stdcall   * pThread )( void * );
 Fun func = (Fun)&CAdapterObj::ThreadFun;

 DWORD dwAddress;
 memcpy(&dwAddress,&func ,sizeof(func ));

 pThread pThrd;
 memcpy(&pThrd, &dwAddress, sizeof(pThrd));

 HANDLE handle  = (HANDLE) _beginthreadex(NULL,0,pThrd, reinterpret_cast< void* >(this) ,0,NULL);

你可能感兴趣的:(C++)