[Openmcl-devel] Bridge and NSTimer

Phil pbpublist at comcast.net
Tue May 1 16:30:05 PDT 2007


The wrong one? Seriously, I see your point... is creating the timer  
on the main thread (i.e. create a new method to create the timer and  
then call it via  
"performSelectorOnMainThread:withObject:waitUntilDone:") the right  
way to do this or is there a better/alternate way?

Thanks,
Phil

On May 1, 2007, at 5:37 PM, Gary Byers wrote:

> What thread does that code run in ?  (I guess that the more relevant
> question is "what NSRunloop is the NSTimer associated with ?")
>
>
>
> On Tue, 1 May 2007, Phil wrote:
>
>> Is there anything special to getting NSTimer to work via the  
>> bridge?  I don't see anything wrong with this code but the timer  
>> doesn't seem to be firing.
>>
>> (defclass timer-test (ns:ns-object)
>> ()
>> (:metaclass ns:+ns-object))
>>
>> (ccl::define-objc-method ((:void :timer-fired the-timer) timer-test)
>> (#_NSLog #@"timer fired"))
>>
>> (setf mytimer-objc (objc:make-objc-instance "TimerTest"))
>> (objc:send (objc:@class "NSTimer")
>> 	    
>> "scheduledTimerWithTimeInterval:target:selector:userInfo:repeats:"
>> 	   1.0d0
>> 	   mytimer-objc
>> 	   (objc:@selector "timerFired:")
>> 	   nil
>> 	   nil)
>>
>> Thanks,
>> Phil
>>
>>




More information about the Openmcl-devel mailing list