in reply to Coro, EV and cede

The docs suggest
async { EV::loop };

That makes me wonder. If that works, then why doesn't cede to the main thread?

Replies are listed 'Best First'.
Re^2: Coro, EV and cede
by Nick Kostirya (Sexton) on Apr 08, 2011 at 06:09 UTC

    I've tried this way at once, but it didn't help.

    Probably cede really doesn't give EV control.

      Just call sleep instead of cede if it works better.

      But you may want to consider the output I got from different sleep lengths in the second thread. I changed from printing the length to print time().

      Using sleep(0), it takes 9s to do a request. first second second second second second second second second second second second second second second second second 1302281756 second first second second second second second second second second second second second second second second second second second 1302281765 Using sleep(1), it takes 2s to do a request. first second second second 1302281791 first second second 1302281793 first second second 1302281795 Using sleep(2), it takes 1s to do a request. first second 1302281819 first second 1302281820 first second 1302281822 first 1302281823

      It gives control to the coro running EventLoop. But of course, that coro is in the EventLoop call. What about

      async { sleep 60 while 1; }