-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 05/18/2014 12:29 PM, Martin Sustrik wrote: > Here's the documentation of the option (from uv.h): > > UV_RUN_ONCE: Poll for new events once. Note that this function > blocks if there are no pending events. > > The text is kind of ambiguous. The implementation itself behaves > like this (here's my debug log): > > ... 287 uv__run_prepare(loop); 288 > uv__run_pending(loop); My callback is executed here! 290 > timeout = 0; 291 if ((mode & UV_RUN_NOWAIT) == 0) 292 > timeout = uv_backend_timeout(loop); 294 uv__io_poll(loop, > timeout); ... > > In other words, the call blocks even if there was an event pending > from before and the corresponding callback was executed within the > call to uv_run(). > > Is this the intended behaviour, or rather a bug? >
This is intended behavior. The "once" is related to polling for i/o. So the loop will block for i/o once. But X callbacks might be fired, if handles are ready or many sockets become readable, etc. Cheers, - -- Saúl Ibarra Corretgé bettercallsaghul.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Using GnuPG with Icedove - http://www.enigmail.net/ iQIcBAEBAgAGBQJTeJlnAAoJEEEOVVOum8BZBK4QANUjQE/LbBsp3c0yd9SMc7+O dpIokTbbKJarD6rKbioOJvuumZ6KsFBXjbfkK7urfkscsUYq8BrpGGYD8/6XiQ9f t3DVFlb+TVIf0hjEXEGi6hPJ1Bml2fDpsWxceDloQTSy3vH0ERkC/t0G8tyr6Vsp vIJmvNdNTGrepouBEtrWkEA2IxAi/b+ddqa5YFCrEZztgTEu30Rc3+NHkIw+vFDc bOfJ5qb4qLRDl9trYafiYakE47bduCHveIWqHUdUBOUHfqLUfSj4BIV5aXiC8H0H c67AJneVgpd2nJzbrcvBnHTxr8T+p4sC9IsQ221LMIFMmKkuNwJmueMVqe26Z8ko IyULij8qbOImzx9PSIGINzTV3flOT4EONf2NMjgGEXqSX/EmkztVV8a2iCjO0GiG IQbmw8PXEBs4eRlSJI4U0LgCrqrOXg0dqC1LDn0rPqgzcPEikr2tJPtEzymKANbl qpZ81SCZFoshP7m3fHrP4eQaG2uHfBYN958VNEsTIOn6ZSndwsGWLlv2sL92Zool Q2XCEkeao5ZQ5vHH8qTp97O2WVTH5DfvU0F6BWDxaAMDitmNrR6rIomWH2yaEqs7 KnXTHXFIbbFyJTxCo4ciHzvimA9M+lt6ZndUcF9iJkYGsx2j9jRu8+lfmnJ6zEv8 lqjvSweoz7Dnv8QDDKAX =b0W1 -----END PGP SIGNATURE----- -- You received this message because you are subscribed to the Google Groups "libuv" 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/libuv. For more options, visit https://groups.google.com/d/optout.
