[swift-corelibs-dev] NSOperationQueue and friends

Daniel Eggert danieleggert at me.com
Sat Mar 26 12:52:49 CDT 2016


> 
> On 25 Mar 2016, at 21:15, Philippe Hausler via swift-corelibs-dev <swift-corelibs-dev at swift.org> wrote:
> 
> I know a few of you have been waiting for this: I just pushed an initial implementation of NSOperationQueue, NSOperation and NSBlockOperation. It is worth noting that this implementaiton has a few behavioral differences between this implementation and the one implemented in objective-c. Part of this difference is due to features like QoS not being cross platform portable or KVO not yet implementable in Swift. This is very much a work-in-progress; it needs unit tests and and a bit more polish, but hopefully it is good enough to get some work started in some other places.
> 
> - Philippe Hausler


Great to see progress on this.

It does fail this simple test case, though:


    func test_BlockBasedAPI() {
        let queue = NSOperationQueue()
        
        let expectation = expectationWithDescription("did run block")
        queue.addOperationWithBlock {
            expectation.fulfill()
        }
        
        waitForExpectationsWithTimeout(0.001, handler: nil)
    }

I'm not sure what's going on there. I was using this on my branch for NSURLSession since it has a delegate queue that I need to run callbacks on.

/Daniel



More information about the swift-corelibs-dev mailing list