Inherits from NSObject
Declared in OSSCancellationTokenSource.h
OSSCancellationTokenSource.m

Overview

OSSCancellationTokenSource represents the producer side of a CancellationToken. Signals to a CancellationToken that it should be canceled. It is a cancellation token that also has methods for changing the state of a token by cancelling it.

Properties

cancellationRequested

Whether cancellation has been requested for this token source.

@property (nonatomic, assign, readonly, getter=isCancellationRequested) BOOL cancellationRequested

Discussion

Whether cancellation has been requested for this token source.

Declared In

OSSCancellationTokenSource.h

token

The cancellation token associated with this CancellationTokenSource.

@property (nonatomic, strong, readonly) OSSCancellationToken *token

Discussion

The cancellation token associated with this CancellationTokenSource.

Declared In

OSSCancellationTokenSource.h

Class Methods

cancellationTokenSource

Creates a new cancellation token source.

+ (instancetype)cancellationTokenSource

Discussion

Creates a new cancellation token source.

Declared In

OSSCancellationTokenSource.h

Instance Methods

cancel

Cancels the token if it has not already been cancelled.

- (void)cancel

Discussion

Cancels the token if it has not already been cancelled.

Declared In

OSSCancellationTokenSource.h

cancelAfterDelay:

Schedules a cancel operation on this CancellationTokenSource after the specified number of milliseconds.

- (void)cancelAfterDelay:(int)millis

Parameters

millis

The number of milliseconds to wait before completing the returned task. If delay is 0 the cancel is executed immediately. If delay is -1 any scheduled cancellation is stopped.

Discussion

Schedules a cancel operation on this CancellationTokenSource after the specified number of milliseconds.

Declared In

OSSCancellationTokenSource.h

dispose

Releases all resources associated with this token source, including disposing of all registrations.

- (void)dispose

Discussion

Releases all resources associated with this token source, including disposing of all registrations.

Declared In

OSSCancellationTokenSource.h