Q1. That's where coroutines are different than OS-level threads: after a
task is created, it will be scheduled to run as soon as possible when the
loop starts to run. Even if the loop is already running, a newly-created
task is not guaranteed to start *immediately* but as soon as possible - in
extreme cases this can be quite long depending on how "bad" other
coroutines are written to block the main thread.

Q2. You'll have to make such a timeline tool by yourself as far as I know.
Depending on whether you want to pause within tasks or simply pause the
timeline object from scheduling new tasks, you may have to create your own
loop or task implementation, or simply a custom tasks' scheduler. However,
what you described doesn't sound quite elegant in asyncio world - even what
I described is implemented and running I think it may be not the "right"
way. Maybe you can specify a bit more about what you are trying to solve
(maybe in private to me, not spamming the list :P) in order for a more
suitable model for your case - using Queue for example.


BR,
Fantix
--
http://about.me/fantix

On Fri, Dec 26, 2014 at 12:50 AM, Mehdi Summer <[email protected]> wrote:

> Thanks for your helps guys!
> Now i'v got how to run coroutines one after another. but still something
> annoys me:
> As soon as i create a task it will run, right? i'm wondering is there any
> way to create all tasks and put them in a kind of timeline and then
> run/pause/stop the timeline?
>

Reply via email to