Skip to content
This repository has been archived by the owner on Nov 15, 2024. It is now read-only.

call cancel() method didn't finish the operation! #83

Open
ichagall opened this issue Nov 24, 2016 · 2 comments
Open

call cancel() method didn't finish the operation! #83

ichagall opened this issue Nov 24, 2016 · 2 comments

Comments

@ichagall
Copy link

for the executing operations , call cancel() don't finish the operation really, the method just mark the operations' state as hasFinished and remove the operations from the queue, in fact these operations are still running.

@scottymac
Copy link

scottymac commented Apr 12, 2017

@ichagall That is the expected behavior. cancel() just sets the state, but does not itself call finish() -- you have to also do that.

EDIT: Looks like PSOperations works differently from the WWDC Operations project. From what I can tell cancel() does in fact call finish() -- I think this makes more sense.

override open func cancel() {
        stateLock.withCriticalScope {
            if isFinished {
                return
            }
            
            _cancelled = true
            
            if state > .ready {
                finish()
            }
        }
    }

@priteshshah1983
Copy link

You should read the discussion in #74 as it is relevant

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants