Actors and Priorities

I am reviewing Swift actors for a project and I need to have some actors operate at higher priority than others (I think of Actors as wrapping a Task with a known priority).

Is it possible to declare an actor's controlling task to have specific priority levels? I am new to actors. I see how to do this with Tasks, but I am looking to do this with an actor.

Thanks in advance,

Charlie

1 Like

This is not the right way to think about actors.

Tasks are the only entities that have priorities. As a task performs its work, it may hop between many different actors. When a task with a high priority runs a job on an actor, that actor "inherits" the task's priority for the duration of the job, if you will.

Task priorities also influence the order in which actors execute their jobs. Lower-priority jobs may have to wait longer when a higher-priority job comes along that needs to run on the same actor.

Thank you for helping me develop the right mental model around actors!