Skip navigation.
 
mlRe: Using NSThreads in command-line apps
FROM : Bill Bumgarner
DATE : Thu May 15 21:25:31 2008

On May 15, 2008, at 12:16 PM, ben syverson wrote:
> On May 15, 2008, at 1:47 PM, Bill Bumgarner wrote:

>> Run an NSRunLoop on your main thread.  That'll support -
>> performSelectorOnMainThread:.

>
> Okay -- interesting. One follow-up question... my core loop is 
> basically:
>
> while(_running) {
>     // do stuff
> }
>
> I don't want to listen to any input, and I want the loop to execute 
> as fast as possible. However, NSRunLoop says I need to set a timer 
> or an input...


Your main thread loop?

If that is the design you want to use, then you can use NSLock -- 
NSConditionLock, typically -- to do the synchronization between 
threads.  If your loop really is running flat out, then using a 
condition lock will be marginally faster.

b.bum

Related mailsAuthorDate
mlUsing NSThreads in command-line apps ben syverson May 15, 20:42
mlRe: Using NSThreads in command-line apps Bill Bumgarner May 15, 20:47
mlRe: Using NSThreads in command-line apps Randall Meadows May 15, 20:49
mlRe: Using NSThreads in command-line apps Uli Kusterer May 15, 20:51
mlRe: Using NSThreads in command-line apps Jens Alfke May 15, 20:52
mlRe: Using NSThreads in command-line apps ben syverson May 15, 21:16
mlRe: Using NSThreads in command-line apps ben syverson May 15, 21:17
mlRe: Using NSThreads in command-line apps Bill Bumgarner May 15, 21:25
mlRe: Using NSThreads in command-line apps Bill Bumgarner May 15, 21:31
mlRe: Using NSThreads in command-line apps ben syverson May 15, 21:53
mlRe: Using NSThreads in command-line apps Jens Alfke May 15, 23:17
mlRe: Using NSThreads in command-line apps ben syverson May 16, 00:28
mlRe: Using NSThreads in command-line apps Sherm Pendley May 16, 00:31
mlRe: Using NSThreads in command-line apps Hamish Allan May 16, 00:33
mlRe: Using NSThreads in command-line apps ben syverson May 16, 00:40
mlRe: Using NSThreads in command-line apps Hamish Allan May 16, 01:06
mlRe: Using NSThreads in command-line apps Jens Alfke May 16, 03:02
mlRe: Using NSThreads in command-line apps ben syverson May 16, 06:50