Skip to content

Doc suggestion: orderedUpdate() make private #1

Description

@garvankeeley

I think making orderedUpdate() private in your final example would be the most realistic usage:

actor Counter {
    private static let data = ["A", "B", "C"]
    private var cursor = 0
    private let queue = SerialQueueThrowing()
    private func orderedUpdate() async {
        cursor += 1
        await Task.yield()
        debugPrint(Self.data[cursor % Self.data.count])
    }
    func update() async throws {
        try await queue.enqueue {
            await self.orderedUpdate()
        }
    }
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions