Cc: swift-corelibs-dev <swift-corelibs-dev@swift.org> Subject: Re: [swift-corelibs-dev] Setting property "maxConcurrentOperationCount = 1" of NSOperation fails to execute operations using OpenSource Foundation.Date: Thu, May 5, 2016 10:54 PM
: swift-corelibs-dev@swift.org
Date: 05/06/2016 09:43 AM
Subject:Re: [swift-corelibs-dev] Setting property
"maxConcurrentOperationCount = 1" of NSOperation fails to
execute operations using OpenSource Foundation.
Sent by:swift-corelib
ibs-dev
> Subject: Re: [swift-corelibs-dev] Setting property
> "maxConcurrentOperationCount = 1" of NSOperation fails to execute operations
> using OpenSource Foundation.
> Date: Thu, May 5, 2016 10:54 PM
>
> Hmm that seems unfortunate. I wonder if the serial creation is due to an
@ Philippe: Your right. Converting the 'attr' to an optional did do the job of creating a serial queue successfully. Thanks for that. I will create a PR for this.
But this makes me think as to why until now, this was not caught by the compiler itself?
Regards
Mamatha
- Original message
Hmm that seems unfortunate. I wonder if the serial creation is due to an
unwrapped optional? var attr: dispatch_queue_attr_t? instead might do the
trick… or alternatively we could just let the underlying queue be concurrent
all the time and enforce the max ops via making the semaphore always
in
Hello
Code snippet:
———
let operation1 : NSBlockOperation = NSBlockOperation (block: {
sleep(1)
print("Opertion1")
})
let operation2 : NSBlockOperation = NSBlockOperation (block: {
sleep(1)
print("Opertion2”)