void * ServeThread(void * vargp)
{
	Pthread_detach(pthread_self());

	while (1)
	{
		int connfd = sbuf_remove(&ClientPool);
		fprintf(stderr, "Thread %llu handling request %d.\n", (unsigned long long int)pthread_self(), connfd);
		ServeClient(connfd);
		Close(connfd);
		fprintf(stderr, "Thread %llu's request %d ended.\n", (unsigned long long int)pthread_self(), connfd);
	}
}
Esempio n. 2
0
task Server() {
  Tcp::Listener s;
  for (;;)
    ServeClient(co_await s.Accept());
}