NSOperationQueue and friends

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

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

···

On 25 Mar 2016, at 21:15, Philippe Hausler via swift-corelibs-dev <swift-corelibs-dev@swift.org> wrote:

Is that on Linux? Perhaps it is because it is missing run loop interaction?

···

Sent from my iPhone

On Mar 26, 2016, at 10:52 AM, Daniel Eggert <danieleggert@me.com> wrote:

On 25 Mar 2016, at 21:15, Philippe Hausler via swift-corelibs-dev <swift-corelibs-dev@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

This is on OS X will everything pulled from master yesterday. I'm using Xcode, and I built a toolchain from source. Same happens with the 2016-03-24 toolchain from swift.org.

For some reason DEPLOYMENT_ENABLE_LIBDISPATCH isn't set, but I guess it should be?

/Daniel

···

On 26 Mar 2016, at 22:54, Philippe Hausler <phausler@apple.com> wrote:

Is that on Linux? Perhaps it is because it is missing run loop interaction?

Sent from my iPhone

On Mar 26, 2016, at 10:52 AM, Daniel Eggert <danieleggert@me.com> wrote:

On 25 Mar 2016, at 21:15, Philippe Hausler via swift-corelibs-dev <swift-corelibs-dev@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

DEPLOYMENT_ENABLE_LIBDISPATCH should not be enabled unless you specifically enable it (this is until we get libdispatch fully integrated into the build system)

···

On Mar 28, 2016, at 1:14 PM, Daniel Eggert <danieleggert@me.com> wrote:

This is on OS X will everything pulled from master yesterday. I'm using Xcode, and I built a toolchain from source. Same happens with the 2016-03-24 toolchain from swift.org.

For some reason DEPLOYMENT_ENABLE_LIBDISPATCH isn't set, but I guess it should be?

/Daniel

On 26 Mar 2016, at 22:54, Philippe Hausler <phausler@apple.com> wrote:

Is that on Linux? Perhaps it is because it is missing run loop interaction?

Sent from my iPhone

On Mar 26, 2016, at 10:52 AM, Daniel Eggert <danieleggert@me.com> wrote:

On 25 Mar 2016, at 21:15, Philippe Hausler via swift-corelibs-dev <swift-corelibs-dev@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

Ok.

That test case fail on OS X, though. Should I open a bug?

/Daniel

···

On Mar 28, 2016, at 22:17, Philippe Hausler <phausler@apple.com> wrote:

DEPLOYMENT_ENABLE_LIBDISPATCH should not be enabled unless you specifically enable it (this is until we get libdispatch fully integrated into the build system)

On Mar 28, 2016, at 1:14 PM, Daniel Eggert <danieleggert@me.com> wrote:

This is on OS X will everything pulled from master yesterday. I'm using Xcode, and I built a toolchain from source. Same happens with the 2016-03-24 toolchain from swift.org.

For some reason DEPLOYMENT_ENABLE_LIBDISPATCH isn't set, but I guess it should be?

/Daniel

On 26 Mar 2016, at 22:54, Philippe Hausler <phausler@apple.com> wrote:

Is that on Linux? Perhaps it is because it is missing run loop interaction?

Sent from my iPhone

On Mar 26, 2016, at 10:52 AM, Daniel Eggert <danieleggert@me.com> wrote:

On 25 Mar 2016, at 21:15, Philippe Hausler via swift-corelibs-dev <swift-corelibs-dev@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

the swift-corelibs-foundation compiled for Darwin does not define that yet either. Are you seeing issues with it when defined?

···

On Mar 28, 2016, at 2:51 PM, Daniel Eggert <danieleggert@me.com> wrote:

Ok.

That test case fail on OS X, though. Should I open a bug?

/Daniel

On Mar 28, 2016, at 22:17, Philippe Hausler <phausler@apple.com> wrote:

DEPLOYMENT_ENABLE_LIBDISPATCH should not be enabled unless you specifically enable it (this is until we get libdispatch fully integrated into the build system)

On Mar 28, 2016, at 1:14 PM, Daniel Eggert <danieleggert@me.com> wrote:

This is on OS X will everything pulled from master yesterday. I'm using Xcode, and I built a toolchain from source. Same happens with the 2016-03-24 toolchain from swift.org.

For some reason DEPLOYMENT_ENABLE_LIBDISPATCH isn't set, but I guess it should be?

/Daniel

On 26 Mar 2016, at 22:54, Philippe Hausler <phausler@apple.com> wrote:

Is that on Linux? Perhaps it is because it is missing run loop interaction?

Sent from my iPhone

On Mar 26, 2016, at 10:52 AM, Daniel Eggert <danieleggert@me.com> wrote:

On 25 Mar 2016, at 21:15, Philippe Hausler via swift-corelibs-dev <swift-corelibs-dev@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

When I add

OTHER_SWIFT_FLAGS = -DDEPLOYMENT_ENABLE_LIBDISPATCH

it works. So I guess that's what I should do?

/Daniel

···

On 28 Mar 2016, at 23:59, Philippe Hausler <phausler@apple.com> wrote:

the swift-corelibs-foundation compiled for Darwin does not define that yet either. Are you seeing issues with it when defined?

Yah, we didn’t want to enable this by default yet because it’s still a work in progress. Also, it requires dispatch on Linux, which we are still working on getting integrated into the overall swift build process.

- Tony

···

On Mar 30, 2016, at 4:42 AM, Daniel Eggert via swift-corelibs-dev <swift-corelibs-dev@swift.org> wrote:

On 28 Mar 2016, at 23:59, Philippe Hausler <phausler@apple.com> wrote:

the swift-corelibs-foundation compiled for Darwin does not define that yet either. Are you seeing issues with it when defined?

When I add

OTHER_SWIFT_FLAGS = -DDEPLOYMENT_ENABLE_LIBDISPATCH

it works. So I guess that's what I should do?

/Daniel

_______________________________________________
swift-corelibs-dev mailing list
swift-corelibs-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-corelibs-dev