On Mon, Mar 31, 2008 at 12:00 PM, Manlio Perillo
<[EMAIL PROTECTED]> wrote:
>  Since Nginx is asynchronous, how can be solved the producer-consumer
>  problem (that is, the Haskell program produces more data that Nginx can
>  send to the client without blocking)?

I assume that the Haskell process is connected to nginx over a pipe or
socket. In which case, nginx can use flow control to block the sending
side of the pipe and the Haskell code will backup on that.

If many connections need to be multiplexed over the same
flow-controlled entity (i.e. a pipe), without head-of-line blocking
then you can just suspend the current thread using an MVar or the STM
objects.

Alternatively, with Network.MiniHTTP the problem is turned inside out.
Request handlers give return a Source object, which can be asked to
generate more data on request. This would be similar to generators in
Python.


AGL

-- 
Adam Langley [EMAIL PROTECTED] http://www.imperialviolet.org
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to