I don't really understand what you want to do. If you want a specific coroutine to run to completion, use $coro->join(). If you want to run any coroutine until no more work is to be done, use Coro::schedule. If you want to start "any coroutine other than me", use cede_notself. In any case, you need to ->join all coroutines that you have spawned at some time earlier in the program, because once the main coroutine ends, no other coroutines will be called anymore.

If you can describe more closely why and how you want to influence the call order, maybe we can find some way. The easiest solution would be if cede took an optional parameter giving the next coroutine to run, but I'm not sure there is a use case for that.

Update: I think the (undocumented) $coro->transfer( $target ) method is what you want to transfer control to another, specified coroutine.


In reply to Re: Coro: running a specific coroutine by Corion
in thread Coro: running a specific coroutine by moritz

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.