Skip to content

Document SWIFT_UNEXPECTED_EXECUTOR_LOG_LEVEL environment variable #136

@dehesa

Description

@dehesa

Swift 5.10 permit the creation of actors with custom executors. A very common use case is actors backed with a DispatchQueue. This is useful when wrapping lower-level APIs, such as FSEventStreams or any queue-backed Core Foundation functionality. For those case, you can define an actor wrapping the state and be sure to be called back in the executor queue.

Swift 6 introduces the assumeIsolated(_:) function that permits to jump synchronously to the actor's critical section; However that functionality is not backported and therefore you need to use "unsafe bitcasting" for systems running in Swift 5 runtimes. The bitcasting sadly produces a warning every time the bitcast is used. For cases such a File System monitor that will produce an exorbitant amount of warnings. The only way to remove those warnings is setting SWIFT_UNEXPECTED_EXECUTOR_LOG_LEVEL=0.

We have discussed this in the Swift forums.

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