[Libevent-users] evhttp and pre-fork model
Nicolas Favre-Félix
n.favrefelix at gmail.com
Fri Nov 23 10:03:52 EST 2007
On Nov 23, 2007 9:44 AM, Marc Lehmann <libev at schmorp.de> wrote:
> On Wed, Nov 21, 2007 at 06:06:51PM +0100, Nicolas Favre-Félix <
> n.favrefelix at gmail.com> wrote:
> > I am trying to implement a server using a "pre-fork" design. It
>
[...]
> libevent doesn't support forking (unless you force it to use select or
> poll) and continue using it in the child.
>
That's actually what I'm doing at the moment, calling listen(), then fork().
Each child adds a callback for EV_READ on the socket and runs its event
loop.
It tries to accept() on it when the callback function is executed, and
handles the client. This has been tested quite heavily without problem...
Could there be one?
You might have luck with ignoring the parent event loop and create a new
> one in your child, at the expense of losing resources.
>
Thank you for your precisions. I don't have an event loop in the parent, so
this is not a problem.
> I'd like to integrate HTTP support - using evhttp.
this was my main question... Is it possible to give evhttp a bound socket to
monitor?
I checked http.c but couldn't find any exported function doing this. If this
isn't implemented, would it be OK to submit a patch to add this feature?
Thanks,
Nicolas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://monkeymail.org/archives/libevent-users/attachments/20071123/1c8eaa2c/attachment.htm
More information about the Libevent-users
mailing list