I'd like to try the Coro together with EV.

There are a few code snippets:

async { while (1) { ... cede; } };

When I use only Coro, everything's fine.

But when I try to connect EV, weird things happen, which can be explained only by the fact cede doesn't pass the control to EV.

It forces me to use cede and Coro::Timer::sleep together:

async { while (1) { ... sleep 0; cede; } };

Coro::Timer::sleep - it's an explicit call to EV.

Has anyone faced such an issue?


UPDATE:
I was wrong, Coro::AnyEvent::poll really helps.
This is the same as sleep(0).
I was pulling his leg, Coro’s author, shame on me.
I just could not figure it out that Coro can be used without IO in practice And those using IO have Coro::AnyEvent::poll.
Still, I learnt that Marc Lehmann is a patient and very polite person.
I got a good lesson too: don’t make the output on STDIN artificially.

In reply to Coro, EV and cede by Nick Kostirya

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.