I'm learning usages of async-await
and along with that read about the Global Actors
. I know MainActor
is GlobalActor
, and if we annotate a method with @mainActor
, the method will be executed on Main Thread. Similar to that if we create a custom GlobalActor, do we know which thread it will use to perform.
@globalActor actor CustomGlobalActor {
static let shared = CustomGlobalActor()
}
@CustomGlobalActor func performTask() async -> Output {
.....
}
Also, additional questions:
- Can we use it interchangeably to perform time consuming tasks in background thread?
- Is it connected to Global Queues in any manner?