|
From: | Wolfgang Lux |
Subject: | Re: NSSound Reimplementation |
Date: | Sun, 28 Jun 2009 22:46:16 +0200 |
Stefan Bidigaray wrote:
I tried setting waitUntilDone to YES, still no luck! The - _finished method still doesn't get called when calling - performSelectorOnMainThread:..., for now I've just made that a - performSelector:withObject:, which works, but is not what I want done. I guess my next question here is: is - performSelectorOnMainThread:withObject:waitUntilDone: working? Maybe I built -base incorrectly?
I don't think so. The problem with - performSelectorOnMainThread:withObject:waitUntilDone: is that the call is only scheduled to be executed by the run loop of the main thread. Thus, the call will not be executed before the next event is received or the next timer expires on the main thread. This is indeed different from Mac OS X, where the scheduled call seems to be executed immediately if the run loop is idle. As a workaround, you could schedule a timer that regularly invokes an empty method in your NSSound class on the main thread, e.g.,
[NSTimer scheduledTimerWithTimeInterval: 1.0 target: self selector: @selector(_heartBeat:) userInfo: nil repeats: YES]; and - (void)_heartBeat:(NSTimer *) { } Wolfgang
[Prev in Thread] | Current Thread | [Next in Thread] |