Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cancellation observer registration: block not called when the token is already cancelled. #291

Open
baoshan opened this issue Nov 30, 2016 · 0 comments

Comments

@baoshan
Copy link
Contributor

baoshan commented Nov 30, 2016

I'm talking about the registerCancellationObserverWithBlock method of the BFCancellationToken class.

According to the header file: If the token is already cancelled the delegate will be notified immediately. Which (I guess) means the block will be invoked immediately if the token isCancellationRequested.

But I can not reproduce the behavior via the below code:

BFCancellationTokenSource *cts = [BFCancellationTokenSource cancellationTokenSource];
[cts cancel];
[cts.token registerCancellationObserverWithBlock:^{
    NSLog(@"never printed");
}];

Through a quick code review, I found nothing related to the behavior neither. I wonder if it's my own problem, a documentation issue, or a possible bug?

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant