Call the -onCancel:/-onComplete: block immediately when already cancelled/completed

#1 · closed · 0 comments

View on GitHub ↗

robrix

This will avoid a race condition: ``` RXFuture *future = [something workWithCompletionHandler:^{ … }]; [future onCancel:^{ … }]; ``` If the future has already been cancelled by the time -onCancel: is called, then the block is never called. Same thing goes for completion handlers that are added to the future after it’s been returned.

Comments