[Spread-users] Spread and select

John Schultz jschultz at spreadconcepts.com
Mon Apr 10 15:23:28 EDT 2006


Hua Zhong wrote:

>I am not sure if I've got what you are saying, but a non-blocking SP_receive should never, erh, block.  It should work this way:
>  
>
>1) if there is no data, return -EAGAIN;
>2) if there is data, read it. If the data is only a partial message, store it in a static buffer for each mailbox (which has max of
>100K), and return -EGAIN.
>3) if there is complete data now in the buffer, return the message to caller.
>
>There is never blocking. The caller would have to expect SP_receive_nb() to return EGAIN even if SP_poll tells there is data. It's
>the whole point of having non-blocking calls: SP_poll never promises a complete message.
>  
>

Yes, that is exactly the solution I meant in my previous message.  When 
I said "it blocks" I meant when the library gets EAGAIN from the OS 
without having yet gotten the whole message, which would block on a 
blocking socket.  In that case, the library would need to store the 
partially received message in an internal buffer and only return the 
entire message during a later SP_receive call when it finished getting 
all of the message.

---
John Schultz
Spread Concepts LLC
Phn:  301 498 3233
Cell: 443 838 2200





More information about the Spread-users mailing list