Home > OS >  How to use the child thread end of the process
How to use the child thread end of the process

Time:01-26

 void * read_func (void * arg) 
{
/* the WRITE and READ */
int ret;
Char buf [BUFSIZ];
Arg int newfd=* (int *);
While (1)
{
Bzero (buf, BUFSIZ);
Do
{
Ret=read (newfd, buf, BUFSIZ - 1);
} while (ret & lt; 0 & amp; & Errno==EINTR);
If (ret & lt; 0)
{
Perror (" read ");
exit(-1);
}
Printf (" the Receive data: % s \ n ", buf);
If (ret==0 | | (STRCMP (buf, "quit \ n")==0)) break;
}
Close (newfd);
Pthread_exit (" exit ");
}


this is a child thread, I'd like to make the client sends the quit the program exits, bosses how to solve?
  • Related