[Spread-users] Receive with timeout

Mark Snelling mark at bakedbeans.com
Thu Jun 1 08:07:37 EDT 2006


Hi

Is there any chance of adding variants of the receive and poll functions 
that accept a timeout parameter?

The combination of the current non-blocking SP_poll() and blocking 
SP_receive() functions make it quite tricky to have a separate receive 
thread, which is quite a common approach for distributed applications.

The problem is that the receive thread blocks while waiting for messages, 
this means there can be no other processing done if there is nothing pending 
(also making shutdown difficult). If you were to poll first and then receive 
if there were messages pending the receive thread would spin as it 
constantly polled. You may add some form of sleep here but that will just 
add extra latency in the time it takes to process the message.

Cheers,

Mark. 







More information about the Spread-users mailing list