On 20 Mar 2013, at 4:28, Roland King wrote:
All the code touching that variable is on the main thread. So it's
serialized by that.
Say you start block A (slow) and block B (fast).
Now block B calls main queue and we have ‘currentOperation ==
currentOperationAtQueueTime’ so we reset currentOp
All the code touching that variable is on the main thread. So it's serialized
by that.
On 16 Mar, 2013, at 23:13, Allan Odgaard wrote:
> On 16 Mar 2013, at 14:14, Roland King wrote:
>
>> […] you have a simple counter member variable, 'currentOperation'. It's set
>> to 0 when you have no oper
On 16 Mar 2013, at 14:14, Roland King wrote:
[…] you have a simple counter member variable, 'currentOperation'.
It's set to 0 when you have no operation and you increment it each
time you make a new one. The code looks like this (typed in mail)
[…]
if( currentOperation == cur
Thanks, Roland.
I can see you are comparing the member variable currentOperation of
the caller's class and a locally declared variable
currentOperationAtQueueTime. Good idea. Obviously, the block retains
"self" of the caller object and all local variables referenced from
within the block. So when
> However, when I use completion blocks instead of delegates, things get
> somewhat vague.
>
> Is it still necessary to store the current operation in a property, or
> does each operation get its own independent copy of the completion
> block, together with its current context? What happens if I
I want to switch to blocks instead of delegates for small callbacks,
e.g. operationDidFinish or animationDidFinish, but there is a question
I cannot understand.
There is the typical scenario when I need to run an operation (usually
in another thread) and while it is running, I should ignore new
re