Skip to content

Operation queue deadlock condition #2

@sgraesser17

Description

@sgraesser17

The operation queue will deadlock if cancelAllOperations is called on the queue before all operations have executed. The culprit is in the start method

guard !isCancelled else { finish() return }

The state value will be .ready which will cause the finish method to never change the state to .finished. Thus, causing a deadlock.

You can either update the guard statement to manually set the state to .finish.
Or, change the finish method to not check for the isExecuting state.

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