Zebediah Figura (@zfigura) commented about dlls/ws2_32/tests/sock.c:
- server = socket(AF_UNIX, SOCK_STREAM, 0);
- ok(server != INVALID_SOCKET, "Could not create Unix socket: %lu\n",
GetLastError());
- ok(!bind(server, (SOCKADDR *)&addr, sizeof(SOCKADDR_UN)), "Could not bind Unix socket: %lu\n",
GetLastError());
- ok(!listen(server, 1), "Could not listen on Unix socket: %lu\n",
GetLastError());
- client = socket(AF_UNIX, SOCK_STREAM, 0);
- ok(client != INVALID_SOCKET, "Failed to create second Unix socket: %lu\n",
GetLastError());
- clientThread = CreateThread(NULL, 0, test_afunix_client_connect_thread,
&(struct afunix_thread_param){ client, addr }, 0, NULL);
- ok(clientThread != NULL, "CreateThread failed unexpectedly: %ld\n", GetLastError());
The thread should be unnecessary, you can just use nonblocking I/O. It doesn't make a big difference, but it's probably easier to read without the thread.
If you do use the thread, you need to clean it up.