In Swift Structured Concurrency, when some Task tries to acquire an actor, it needs to check whether if the actor is already busy and work can be done synchronously, without suspension.
However, multiple tasks can easily need to check if actor is busy all at the same time, which means that some synchronization mechanism is in order.
So what is the synchronization mechanism that synchronizes the inner workings of the actor? Can you provide a link to the relevant parts of the Swift source code?
I believe it uses a dispatch_lock_t
under the hood. Actors are implemented in the runtime in C++. It's open source, so you can inspect the code yourself: