Sorry Matt, I was not precise enough. It was only an example. The reality is that I am building a new sort of platform above node and was curious if there is something I can invoke to force the event loop immediately to be processed.
I found UV_RUN_NOWAIT but it seems not to fire any http listeners (when a new connection is received). C++ code: // Within a C++/v8 addon int r = uv_run(uv_default_loop(), UV_RUN_NOWAIT); I modified the library uvrun <https://github.com/creationix/uvrun> to use the option UV_RUN_NOWAIT, but it does not work properly. It does not fire any callbacks even if I call it within a while-loop. Any clue why? Or who I may ask? Den torsdag 22 januari 2015 kl. 02:59:51 UTC+1 skrev Matt Sergeant: > > Yes it's called existsSync(). You don't need some fancy function to call > the event loop if you just want to find a file before the rest of your code > starts. > > On Wed, Jan 21, 2015 at 6:06 PM, Fredrik O <[email protected] <javascript:> > > wrote: > >> I need to call a function synchronously which trigger the event loop to >> be processed before the function returns. Pseudo code: >> >> >> require('fs').exists('file', function() { >> // This function should be fired even for the while-loop below >> }); >> >> while(true) { >> runEventLoop(); // process the eventloop, so all asynchronous tasks >> will be run anyway >> } >> >> >> Is there any inbuilt function for that? >> >> >> Thanks in advance! >> >> -- >> Job board: http://jobs.nodejs.org/ >> New group rules: >> https://gist.github.com/othiym23/9886289#file-moderation-policy-md >> Old group rules: >> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines >> --- >> You received this message because you are subscribed to the Google Groups >> "nodejs" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> To post to this group, send email to [email protected] >> <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/nodejs/08f6b047-e4d1-40ef-97f6-b5b91d82e198%40googlegroups.com >> >> <https://groups.google.com/d/msgid/nodejs/08f6b047-e4d1-40ef-97f6-b5b91d82e198%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > > -- Job board: http://jobs.nodejs.org/ New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines --- You received this message because you are subscribed to the Google Groups "nodejs" 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]. To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/fd04c0ab-dd63-4d47-85b1-e533d430c32b%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
