jacksonh / manos

Manos is an easy to use, easy to test, high performance web application framework that stays out of your way and makes your life ridiculously simple.
Other
455 stars 61 forks source link

context.Start() should not block when loop empty, or should it? #124

Closed txdv closed 9 years ago

txdv commented 13 years ago

I wonder If we should introduce a feature so context.Start() would not block if there would be nothing on the loop. Imagine you would just open up an udp socket, send some packets somewhere without listening and then close it. Node supports something like that, though they have only 1 event loop, but it will just end the program if no tcp socket is open or listening.

Furthermore, as much as I remember I tried to use Stop() in order to actually get out of the loop, but had no luck as well. Was that tested? Or am I doing something wrong? I'll try to add a test case.

ghost commented 13 years ago

Context.Start() runs the context until something in the context stops the run. There are nonblocking run methods on the context, just read the interface. :)

txdv commented 13 years ago

I know that there is a non blocking variant, but the variant in node blocks only if there is some work to process, if there is nothing on the loop, it will fall through, if there is some work, it won't - it will actually block.