: Thank you for your comment.
:
: I have two cases in that select() should returns,
: . when any of the descriptors are ready
: . when a specific signal(ie, SIGUSR1) is pending
:
: What I want to do is like this:
:
:       unblock SIGUSR1
:       select();
:       block SIGUSR1
:
: This code seems good, but has a problem.
: If a SIGUSR1 signal arrives between unblock and select(), the signal is 
: lost. so, select() can sleep forerver.

This isn't as elegant, but would something like the following work?

BLOCK SIGUSR1
nullWait.tv_sec  = 0;
nullWait.tv_usec = 0;
descriptorReadyFlag = FALSE;
done = FALSE;
while (!done)
{
    numReady = select(maxFd+1, &readSet, &writeSet, &excptSet, &nullWait); 
    assert (sigpending(&pendingSet) == 0);
    if (sigismember(&pendingSet, SIGUSR1)) {
        done = TRUE;
        UNBLOCK SIGUSR1  /* using sigprocmask */
    } 
    if (numReady > 0) {
        done = TRUE;
        descriptorReadyFlag = TRUE;
    }
} 

--
Justin Gamble
-
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to [EMAIL PROTECTED]

Reply via email to