void *thread(void *vargp) { Pthread_detach(pthread_self()); while (1) { int connfd = sbuf_remove(&sbuf); /* Remove connfd from buffer */ echo_cnt(connfd); /* Service client */ Close(connfd); } }
/* thread routine */ void *thread(void *vargp) { int connfd = *((int *)vargp); Pthread_detach(pthread_self()); Free(vargp); echo_cnt(connfd); Close(connfd); return NULL; }
void *thread(void *vargp) { Pthread_detach(Pthread_self()); while (1) { int connfd = sbuf_remove(&sbuf); echo_cnt(connfd); Close(connfd); } }