Skip to content

Investigate options for single-motion starting of service tasks #687

@williampMSFT

Description

@williampMSFT

Right now, we have a sort of 2-phase init pattern for starting services - the user calls one function to instantiate the service, and then the user has to manually start all the tasks the service requires to function. This leaves the opportunity for the caller to screw up - they can fail to start the tasks. The upside of doing it this way is that it breaks our dependency on the async executor, so we can run on e.g. tokio, but this is a pretty substantial drawback.

Investigate ways to start tasks as part of the new/init function so users don't have the opportunity to get this wrong. We have a couple leads to investigate:

  • Maybe we can do something with macros where we decorate our task functions with embassy task decorations if the user somehow communicates to us that it's using embassy as the executor?
  • Maybe we can figure out how the embassy task decorations work and manually implement something that lets us use them in the same way as e.g. tokio tasks?
  • ...something else?

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions