线程函数:
DWORD WINAPI socket2(LPVOID lpp)
{
SOCKET s = ((RECVPARAM*)lpp)->ServerSocket;
//do morething...
return 0;
}
创建线程:
struct RECVPARAM
{
SOCKET ClientSocket;
SOCKET ServerSocket;
};
RECVPARAM* svc; //这个svc的值是一大堆函数生成的,这里就不贴了
DWORD tid;
RECVPARAM th2 = {svc->ServerSocket,svc->ClientSocket};
int x = "0"; //我还想把这个x传给socket2函数
HANDLE h2 = CreateThread(0,0,socket2,&th2,0,&tid);
请问在CreateThread单独时候怎么把X也传给socket2函数?
新手 大神轻喷
已解決,重新定義一個結構體即可