[Spread-users] Multiple connections: how long between calls to SP_poll() ?

matthew.garman at gmail.com matthew.garman at gmail.com
Thu Aug 30 10:32:18 EDT 2007


I've got an application that creates several spread connections to
different spread daemons.

My code structure is basically like this:

/* assume five spread connections to five different
 * spread daemons */
mailbox mbox[5];
while (1) {
    for (i=0; i<5; i++) {
        if (SP_poll(mbox[i])) {
            /* receive data, do something interesting */
        }
    }
    sleep(n); /* what's the max value of n? */
}

My question is, what is the maximum value I can sleep between calls
to SP_poll() without missing any messages?  (I.e., to minimize CPU
usage?)

Obviously I can't use SP_receive() here, since it blocks (unless I
wrote a multi-threaded program, which I'm trying to avoid).

In other words, how long will a spread daemon "hold" a message
for its clients?

Thanks,
Matt





More information about the Spread-users mailing list