sage -From: phaus...@apple.comTo: Mamatha Busi/India/IBM@IBMINCc: swift-corelibs-dev <swift-corelibs-dev@swift.org> Subject: Re: [swift-corelibs-dev] Setting property "maxConcurrentOperationCount = 1" of N
dev@swift.org>
To: Mamatha Busi <mamab...@in.ibm.com>
Cc: 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
@ 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
Hello
Code snippet:
———
let operation1 : NSBlockOperation = NSBlockOperation (block: {
sleep(1)
print("Opertion1")
})
let operation2 : NSBlockOperation = NSBlockOperation (block: {
sleep(1)