Declared in NSThread+BMKitAdditions.h

Overview

BMKit additions to the NSThread class.

Tasks

Initializing an NSThread Object

Starting a Thread

Class Methods

detachNewThreadBlock:

Detaches a new thread and uses the specified block as the thread entry point.

+ (void)detachNewThreadBlock:(BMBlock)aBlock

Parameters

aBlock

The block to execute.

Discussion

In contrast to the detachNewThreadSelector:toTarget:withObject: class method of the NSThread class, you do not need to set up an autorelease pool for the block in a non garbage-collected environment. This is done automatically.

The block aBlock is copied, and released when the thread finally exits. The detached thread is exited (using the exit class method of the NSThread class) as soon as aBlock has completed executing.

If this thread is the first thread detached in the application, this method posts the NSWillBecomeMultiThreadedNotification with object nil to the default notification center.

Declared In

NSThread+BMKitAdditions.h

Instance Methods

initWithBlock:

Returns an NSThread object initialized with the given arguments.

- (id)initWithBlock:(BMBlock)aBlock

Parameters

aBlock

The block to execute.

Return Value

An NSThread object initialized with the given arguments.

Discussion

In contrast to the initWithTarget:selector:object: instance method of the NSThread class, you do not need to set up an autorelease pool for the block in a non garbage-collected environment. This is done automatically.

The block aBlock is copied, and released when the thread finally exits.

Declared In

NSThread+BMKitAdditions.h