lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Tuesday 17 May 2005 7:20 am, Romulo Bahiense wrote:
> 	I was thinking about the async request. Copas uses coroutines to handle
> the IO, so would it be possible to create a special case to Xavante
> where the [url]handler returns a thread (coroutine) and then Xavante
> sends it's results (coroutine.resume) to socket's output as long as the
> thread is not dead? xavante.httpd.send_response() already checks if
> res[ponse].content is a table or a string.

you can call httpd.send_res_data(res,data) in a loop; wouldn't that be the 
same? Copas gets it's chance to arbitrate on each res.socket:send(data)

i also thought of allowing res.content to be a function (that would be more 
generic).  but couldn't find any usage pattern where it would be cleaner than 
just calling httpd.send_res_data()

>
> 	I think it would be more elegant than spawing threads / forks /
> whatever -- and more simple too. That would "make my day" :)

hard threads/forks are the only way when the code you call takes a long time 
without generating output.

-- 
Javier

Attachment: pgpZizRvARfQg.pgp
Description: PGP signature