Skip to content

Question: Is running the task from schedule OK? #5

Closed
@vorner

Description

@vorner

Hello

When browsing code around, I've came to wonder about one thing. What would go wrong, if I created a trivial „recursive“ executor by running the task directly inside the schedule closure? Eg:

let (task, handle) = async_task::spawn(future, Task::run, ());
task.run();

So far, this has crossed my mind:

  • It'll probably make it run in whatever thread wakes the future (so the thread that polls timers or epoll or whatever), which might not be happy about the added latencies.
  • Can the task get called recursively somehow?
  • If so, doesn't that create two mut references to the future?

Or, are there any other problems or restrictions what the schedule closure can do?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions