dev 修复Linux中create_thread的第一个参数为NULL的问题
This commit is contained in:
parent
d42fcd471d
commit
92ac3d94bc
@ -95,7 +95,9 @@ static inline int thread_create(TID* tid, void(*start_routine)(void*), void* arg
|
|||||||
if (h == NULL) { return ERR_THREAD_CREATE; }
|
if (h == NULL) { return ERR_THREAD_CREATE; }
|
||||||
if (!CloseHandle(h)) { return ERR_THREAD_WIN_CLOSE_HANDLE; }
|
if (!CloseHandle(h)) { return ERR_THREAD_WIN_CLOSE_HANDLE; }
|
||||||
#elif _OS_LINUX
|
#elif _OS_LINUX
|
||||||
if (pthread_create(tid, NULL, (void*(*)(void*))start_routine, arg) != 0) { return ERR_THREAD_CREATE; }
|
TID ttid;
|
||||||
|
if (pthread_create(&ttid, NULL, (void*(*)(void*))start_routine, arg) != 0) { return ERR_THREAD_CREATE; }
|
||||||
|
if (tid) *tid = ttid;
|
||||||
#endif
|
#endif
|
||||||
return ERR_THREAD_SUCCESS;
|
return ERR_THREAD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ int main(int argc, char** argv)
|
|||||||
int res;
|
int res;
|
||||||
char Buf[1024] = { 0 };
|
char Buf[1024] = { 0 };
|
||||||
printf("connect server...\n");
|
printf("connect server...\n");
|
||||||
res = make_client_sock(&cfd, "::1", _SOCKET_TEST_PORT);
|
res = make_client_sock(&cfd, _SOCKET_TEST_IP6, _SOCKET_TEST_PORT);
|
||||||
if (res != 0) {
|
if (res != 0) {
|
||||||
printf("error client sock\nerror code:%d\npress enter to continue\n", res);
|
printf("error client sock\nerror code:%d\npress enter to continue\n", res);
|
||||||
getchar();
|
getchar();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user