usbdmx.com Home of the opto isolated, bus powered, DMX512 interface with both in and out universes. Cheap and simple to build. USBDMX logo

LOTimingThread Class Reference

A Thread that can be used for timing independant of the GUI, meaning that gui operations do not block timing events. More...

#import <LOTimingThread.h>


Public Member Functions

(void) - stopThread
 Stop the timing thread.
(NSThread *) - timingThread
 Get the timing thread.
(BOOL) - tap
 Accept a users tap.
(NSTimeInterval) - tapInterval
 Get the current tap interval.
(unsigned) - tapBPM
 Get the tap interval as the nearest Beats Per Minute.
(void) - performSelector:onObject:
 Perform a selector on a given object in the timing thread.
(void) - performSelector:withObject:onObject:
 Perform a selector on a given object in the timing thread.
(void) - performSelector:withObject:withObject:onObject:
 Perform a selector on a given object in the timing thread.
(void) - performSelector:onObject:withParams:
 Perform a selector on a given object in the timing thread.
(void) - invoke:
 invoke a method in the timing thread

Static Public Member Functions

(LOTimingThread *) + sharedTimingThread
 Get the default thread for the application.

Protected Attributes

BOOL timingThreadRunning
 Boolean to indicate it the thread is running.
NSLock * threadRunningLock
 A thread running lock.
NSPort * timingPort
 Port to communicate with the timing thread.
NSThread * timingThread
 The timing thread.
NSLock * lock
 A Lock to protect access to the array.
NSLock * restartLock
 A lock used when restarting the thread.
NSMutableArray * invocations
 Array of invocations for the thread to run.
NSDate * lastTap
 Time of the last tap.
unsigned tapCount
 The number of taps the user has made.
NSTimeInterval tapProgress [4]
 The in progress tap intervals.
NSTimeInterval tapInterval
 The current tap interval.


Detailed Description

A Thread that can be used for timing independant of the GUI, meaning that gui operations do not block timing events.

Member Function Documentation

- (void) invoke: (NSInvocation *)  invocation  

invoke a method in the timing thread

- (void) performSelector: (SEL)  aSelector
onObject: (id)  anObject 

Perform a selector on a given object in the timing thread.

- (void) performSelector: (SEL)  aSelector
onObject: (id)  theObject
withParams: (void *)  firstParam
,   ... 

Perform a selector on a given object in the timing thread.

Allows you to pass a variable number of parms, the param list must be NULL terminated, and must have the smae number of params as the selector expects

- (void) performSelector: (SEL)  aSelector
withObject: (id)  anObject
onObject: (id)  theObject 

Perform a selector on a given object in the timing thread.

Allows you to pass a parameter

- (void) performSelector: (SEL)  aSelector
withObject: (id)  anObject
withObject: (id)  anotherObject
onObject: (id)  theObject 

Perform a selector on a given object in the timing thread.

Allows you to pass two parameters

+ (LOTimingThread *) sharedTimingThread  

Get the default thread for the application.

- (void) stopThread  

Stop the timing thread.

- (BOOL) tap  

Accept a users tap.

Returns:
YES if enough taps have been done to create a meaningful tap interval

- (unsigned) tapBPM  

Get the tap interval as the nearest Beats Per Minute.

See also:
tapInterval

- (NSTimeInterval) tapInterval  

Get the current tap interval.

See also:
- tapBPM

- (NSThread *) timingThread  

Get the timing thread.


The documentation for this class was generated from the following files: