rendered paste body/* hangs on Solaris... exits on Linux and BSD */#include <sys/types.h>#include <sys/socket.h>#include <netinet/in.h>#include <pthread.h>#include <stdio.h>static void *thr(void *arg){ int fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); const int y = 1; struct sockaddr_in new_conn; socklen_t new_conn_len = sizeof(new_conn); setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &y, sizeof(y)); listen(fd, SOMAXCONN); accept(fd, (void *)&new_conn, &new_conn_len); printf("finished\n"); return NULL;}int main(void){ pthread_t id; int i; pthread_create(&id, NULL, thr, NULL); for(i = 0; i < 10000000; ++i) /* just wait a little until thread is in accept() */; pthread_cancel(id); pthread_join(id, NULL); return 0;}