Skip to content

Doc suggestion: orderedUpdate() make private #1

@garvankeeley

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()
        }
    }
}

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