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?
|