diff --git a/include/tthread.h b/include/tthread.h index 5fd11cb..d70dbaf 100644 --- a/include/tthread.h +++ b/include/tthread.h @@ -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; } diff --git a/test/client/client.c b/test/client/client.c index f36afef..4f1f8d6 100644 --- a/test/client/client.c +++ b/test/client/client.c @@ -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();