Re: Alternative to Delay()
Re: Alternative to Delay()
- Subject: Re: Alternative to Delay()
- From: Philippe Wicker <email@hidden>
- Date: Tue, 29 Jul 2003 21:10:15 +0200
On Tuesday, July 29, 2003, at 08:55 PM, Chris Reed wrote:
On Tuesday, Jul 29, 2003, at 01:05 US/Central, Philippe Wicker wrote:
When you call usleep() for say 1 second, the thread (in your case the
UI thread) in which you made that call is waiting for this delay to
end
up and then won't go back to the EventLoop for this duration of 1 sec.
Using a CFRunLoopTimer is much better because user events may still be
processed. Here is the code (from a C++ program) to setup a
CFRunLoopTimer.
A key point here is that usleep() will sleep only the thread on which
it is called. So if you have a CoreAudio IOProc running, that will
continue to work.
Yeah, this is the miracle of multithreading :-)
The user just won't be able to operate any UI elements. And if the
delay is long enough, the spinning rainbow cursor (whatever it's
called) will appear, indicating the main run loop is not responding.
-chris
Philippe Wicker
email@hidden
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.