On Fri, Feb 21, 2014 at 4:40 PM, fredb <[email protected]> wrote:

> Sounds reasonable to me.
>
> The event might not be needed in some cases, such as with what I'm doing
> where I'm creating a thread and then want to tell mongoose that I'm done.
> If there were a mg_request_completed function or some such thing that could
> be called from within the thread, I could see that making things a lot more
> straight-forward. That function could wake up the select and have things
> process as normal.
>
> Incidentally, I've woken up selects in the past by adding a pipe to the
> set and then writing to the pipe. Works well and might not have the
> overhead of writing to a socket.
>

I think we're talking about the same thing here. mg_request_completed() and
mg_wakeup_server() fulfill the same purpose: they wakeup the select.
Writing to a pipe or to a socketpair socket have similar overhead IMO, they
both are just connected file descriptors with in-kernel synchronization and
IO buffers. The difference is that socketpair is full duplex, which allows
to send back a reply, whereas pipe is simplex on most systems. The other
difference is that on some platforms (e.g. Windows) select works only on
sockets, not other file descriptors like pipes.

Okay, I think the plan is set: I am going to introduce mg_wakeup_server()
and going to move to the evented API rather then making more and more
callbacks.


>
> BTW, I've been reading through the source code quite a bit and it's really
> top-notch stuff. My compliments on such fine work.
>

Thank you. There are a lot of things that could be improved, and that is
going to happen
thanks to all the contributors like yourself!

Sergey.

-- 
You received this message because you are subscribed to the Google Groups 
"mongoose-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/mongoose-users.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to