Hi,
I've been experimenting with trying to create a timer with a
granularity of less than 1 millisecond. One of the things I've been
trying is using a thread to post custom Carbon events periodically to
the main application event queue. In my thread I have a loop which
uses MPDelayUntil() to pause for a little while and then post the
event. I have an event handler installed on the application to
process the event.
I've found that this process really effects the responsiveness of the
app, even if my event handler does nothing except return noErr. If I
make the thread wait two seconds before posting the event it takes a
while for anything to happen when I try and interact with the app.
For example, just trying to move the window is very difficult, you
start a window drag and then it catches up a while longer ( I'm
trying to avoid saying about 2 seconds longer :-). If I make the
thread wait a shorter time this improves, although even with a wait
of just 1 millisecond things are still pretty bad.
It almost seems like what I'm doing is stalling the event loop
somehow. I've done this before ( posting custom events from a thread
peridocially ) without this sort of trouble, so I'm a bit puzzled.
Here's the loop from my thread :
AbsoluteTime absTime = ::DurationToAbsolute( 1 );
while ( done == false )
{
::MPDelayUntil( &absTime );
error = ::CreateEvent( NULL, 'UCRT', 'QTFN', 0, kEventAttributeNone,
&theEvent );
error = ::PostEventToQueue( ::GetMainEventQueue(), theEvent,
kEventPriorityStandard );
::ReleaseEvent( theEvent );
}
Does anyone have any ideas what might be going on ? It seems a bit
like the event loop isn't running until I post an event to queue,
although that doesn't make sense.
This is on OS X 10.4.3.
Regards,
Jo
--
Jo Meder
Planetside Software
jomeder@plan...
Terragen for Macintosh
Photorealistic landscapes on your Mac
<
http://www.planetside.co.uk/terragen/mac/>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list (
Carbon-dev@list...)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/subscriber%40opensubscriber.com
This email sent to
subscriber@open...
opensubscriber is not affiliated with the authors of this message nor responsible for its content.