Inherits from NSObject
Declared in BFTaskCompletionSource.h

Overview

A BFTaskCompletionSource represents the producer side of tasks. It is a task that also has methods for changing the state of the task by settings its completion values.

Properties

task

The task associated with this TaskCompletionSource.

@property (nonatomic, retain, readonly) BFTask *task

Discussion

The task associated with this TaskCompletionSource.

Declared In

BFTaskCompletionSource.h

Class Methods

taskCompletionSource

Creates a new unfinished task.

+ (instancetype)taskCompletionSource

Discussion

Creates a new unfinished task.

Declared In

BFTaskCompletionSource.h

Instance Methods

cancel

Completes the task by marking it as cancelled. Attempting to set this for a completed task will raise an exception.

- (void)cancel

Discussion

Completes the task by marking it as cancelled. Attempting to set this for a completed task will raise an exception.

Declared In

BFTaskCompletionSource.h

setError:

Completes the task by setting the error. Attempting to set this for a completed task will raise an exception.

- (void)setError:(id)error

Parameters

error

The error for the task.

Discussion

Completes the task by setting the error. Attempting to set this for a completed task will raise an exception.

Declared In

BFTaskCompletionSource.h

setException:

Completes the task by setting an exception. Attempting to set this for a completed task will raise an exception.

- (void)setException:(id)exception

Parameters

exception

The exception for the task.

Discussion

Completes the task by setting an exception. Attempting to set this for a completed task will raise an exception.

Declared In

BFTaskCompletionSource.h

setResult:

Completes the task by setting the result. Attempting to set this for a completed task will raise an exception.

- (void)setResult:(id)result

Parameters

result

The result of the task.

Discussion

Completes the task by setting the result. Attempting to set this for a completed task will raise an exception.

Declared In

BFTaskCompletionSource.h

trySetCancelled

Sets the cancellation state of the task if it wasn’t already completed.

- (BOOL)trySetCancelled

Return Value

whether the new value was set.

Discussion

Sets the cancellation state of the task if it wasn’t already completed.

Declared In

BFTaskCompletionSource.h

trySetError:

Sets the error of the task if it wasn’t already completed.

- (BOOL)trySetError:(id)error

Parameters

error

The error for the task.

Return Value

whether the new value was set.

Discussion

Sets the error of the task if it wasn’t already completed.

Declared In

BFTaskCompletionSource.h

trySetException:

Sets the exception of the task if it wasn’t already completed.

- (BOOL)trySetException:(id)exception

Parameters

exception

The exception for the task.

Return Value

whether the new value was set.

Discussion

Sets the exception of the task if it wasn’t already completed.

Declared In

BFTaskCompletionSource.h

trySetResult:

Sets the result of the task if it wasn’t already completed.

- (BOOL)trySetResult:(id)result

Return Value

whether the new value was set.

Discussion

Sets the result of the task if it wasn’t already completed.

Declared In

BFTaskCompletionSource.h