-
Notifications
You must be signed in to change notification settings - Fork 7.3k
allow recursive/nested ticks #7555
Comments
See my explanation on the nodejs Google group for what (I understand) is going on in |
Are you calling uv_run(b) from inside uv_run(a)? That should work but it will block the outer uv_run() until the inner uv_run() returns. That isn't necessarily a problem if you pass in UV_RUN_NOWAIT. If you're trying to recurse - i.e. call uv_run(a) from inside uv_run(a) - that won't work. I've toyed with the idea of making the event loop re-entrant^ but there was a performance cost associated with it that I didn't think was worth it. ^ So I could use libuv with Chicken Scheme. Chicken is strictly CPS, functions never return. If your native code calls a scheme function, it's going to be CPS as well, whether it likes it or not. Ergo, the need for a re-entrant libuv. |
i'm hoping to call uv_run(b) form inside uv_run(a), but a and b are not mutually exclusive. there is an explicit transfer of selected descriptors ( signals, timers, etc., i.e. event sources ) from a to b; there is also implicit transfer back of any "live" event sources upon exiting a, i.e. anything transferred in and still open and anything created while inside a. Consider eventScope Javascript function:
so this provides a form of "selective receive", where user can directly control sequential processing order . thanks! |
@eghteentwelve have a look at #7323 |
yep, so what's the plan? |
I've made a proof of concept some time ago: vkurchatkin/node@5477d44 |
Here is my situation: i love node.js and base my project on it; but i do feel that i'm not going to be successful unless i provide "selective receive" ( mostly due to nature of my users and type of programs they write ). I'm now looking at different ways of implementing it ( in order of my preference ):
|
@eghteentwelve what is your use case for "selective receive"? |
nature of my users and type of programming they do ( personally, i also find it easier to reason about large programs when helped by "selective receive" ). unfortunately i cannot comment more on my use cases. thx |
"selective receive" name comes from Erlang btw :) but the nested loop techniques are everywhere, in your modal dialog box, in your C programs that do write(); read();, in you networked file system, etc... |
if you don't really need blocking, I think this can be done purely in javascript, maybe with some generator sugar |
i didn't want to use the "b" word, but, yes, i need blocking call semantics. implementing it all in javascript using existing node facilities is not very high on my list, in fact it's number 4.. :-) |
@vkurchatkin ... any further thoughts on this? |
Ok, marking this as a defer to converged then |
Please allow for recursive/nested ticks, i.e. functions registered with process.nextTick(). Specifically I'm talking about modifying below node.cc code to remove in_tick guards:
I'm asking this to enable correct operation of add-ons utilizing libuv nested loops. If this request cannot be done, please explain how recursive/nested ticks can happen today in user-land or, perhaps, it's only an issue in node-core?
many thanks
The text was updated successfully, but these errors were encountered: