Open System Services Programmer's Guide
accept_fd = accept(sock, NULL, NULL);
if (accept_fd < 0)
{
perror("Accept Error");
exit(-1);
}
/*
Dispatches a thread to handle service request:
*/
if(pthread_create(&my_thread,&my_attr,&worker_thread,&accept_fd)
{
perror("pthread_create");
exit(-1);
}
} /* while */
}/* main */
Example 68 (page 339) also creates a threaded time-of-day server socket, but using $RECEIVE.
338 Using the Standard POSIX Threads Library