[Spread-users] 回复: Is there any elegant way to make application to regain CPU from being blocked in receive() ?

lzhshen 29585543 at qq.com
Thu Nov 6 22:43:18 EST 2008


The "select()" in PHP's spread-extension still does not make sense to me yet.

I'm using spread's C++ interface.

 
------------------ 原始邮件 ------------------
发件人: "Alexey Zakhlestin"<indeyets at gmail.com>;
发送时间: 2008年11月5日(星期三) 晚上7:23
收件人: "lzhshen"<29585543 at qq.com>; 
抄送: "spread-users"<spread-users at lists.spread.org>; 
主题: Re: [Spread-users] Is there any elegant way to make application to regain CPU from being blocked in receive() ?

 
  2008/11/4 lzhshen <29585543 at qq.com>:
> FYI, sender sets an alarm (10 secs) before calling receive() for ACK event.
> If there is
> no ACK event in 10 secs, sender will receive a SIG_ALARM signal and signal
> handler
>  will be invoked. In the signal handler, sender uses siglongjmp() to jump
> back to
>  resend event logic.
>
> Is there any problem with this logic? Doe siglongjmp make sender fail to
> receive ACK
>  event even after the receiver become alive?
>
> Is there any more elegant way to make sender to regain CPU from being
> blocked in
> receive() if there is no ACK event in a centain period of time?

PHP's spread-extension uses select() call to check if there is any
data on socket, and uses timeout parameter of select() to wait for
timeout.
Check sources here:
http://cvs.php.net/viewvc.cgi/pecl/spread/php_spread.c?view=markup&pathrev=MAIN

search for "select("


> Thanks in advance!
>
> ------------------ 原始邮件 ------------------
> 发件人: "Alexey Zakhlestin"<indeyets at gmail.com>;
> 发送时间: 2008年10月23日(星期四) 凌晨0:28
> 收件人: "lzhshen"<29585543 at qq.com>;
> 抄送: "spread-users"<spread-users at lists.spread.org>;
> 主题: Re: [Spread-users] how does Spread make sure that the event is
> successfully delivered to the subscriber?
>
> On Wed, Oct 22, 2008 at 12:58 PM, lzhshen <29585543 at qq.com> wrote:
>>     When the event publisher sends the event to Spread and the subscriber
>> lose the connection with Spread, will this event be lost forever? Will
>> Spread sends the same event to the subscriber when it connects to Spread
>> again?
>
> it won't.
> this kind of logic is supposed to be implemented on application-level.
>
> think of spreas as of "UDP". if you need to verify delievery, you have
> to implement "TCP" on top of it
>
> --
> Alexey Zakhlestin
> http://blog.milkfarmsoft.com/



-- 
Alexey Zakhlestin
http://blog.milkfarmsoft.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.spread.org/pipermail/spread-users/attachments/20081107/4438c52d/attachment.html 


More information about the Spread-users mailing list