dev 修复Linux中create_thread的第一个参数为NULL的问题

This commit is contained in:
zzy-linux 2023-10-26 21:45:55 +08:00
parent d42fcd471d
commit 92ac3d94bc
2 changed files with 4 additions and 2 deletions

View File

@ -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 (!CloseHandle(h)) { return ERR_THREAD_WIN_CLOSE_HANDLE; }
#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
return ERR_THREAD_SUCCESS;
}

View File

@ -30,7 +30,7 @@ int main(int argc, char** argv)
int res;
char Buf[1024] = { 0 };
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) {
printf("error client sock\nerror code:%d\npress enter to continue\n", res);
getchar();