26.8 Condition Variables


Exercises

25.1

An alternate design for the loop in Figure 25.4 is the following:

 
 for ( ; ; ) { Sigprocmask(SIG_BLOCK, &newmask, &oldmask); while (nqueue == 0) sigsuspend(&zeromask); /* wait for datagram to process */ nqueue--; /* unblock SIGGIO */ Sigprocmask(SIG_SETMASK, &oldmask, NULL); Sendto(sockfd, dg[iget].dg_data, dg[iget].dg_len, 0, dg[iget].dg_sa, dg[iget].dg_salen); if (++iget >= QSIZE) iget = 0; } 

Is this modification acceptable?




UNIX Network Programming Volume 1, Third Edition
Unix Network Programming, Volume 1: The Sockets Networking API (3rd Edition)
ISBN: 0131411551
EAN: 2147483647
Year: 2003
Pages: 441

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net