Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: Delayed Events
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Delayed Events





Philippe Wicker wrote:

Can you tell us some more about the threads that are involved: who is the signaling thread? How (when) do you decide to signal the waiter? Are there several synchronization points in the waiter thread? What thread is sending the midi note?

This only started occuring after upgrading to Panther from Jaguar. I am after a 5ms resolution. Can Panther offer me this reliably using POSIX threads?


The OS X scheduler can give very sharp resolution using cond_timedwait, a 5ms resolution (and even much better) is possible. Now the point is how is the midi note sender thread scheduled: is it a time shared or a real time thread? If time shared, did you give it the default priority or did you try to boost its priority? What is the amount of work it has to execute when it wakes up?

I can actually see what is happening by putting the following diagnostic in while (!exit_schedule) { unsigned expected_callback = Scheduler::getTime() + wait_interval; printf("Wait %u\r\n", wait_interval); printf ("Expect call %u\r\n", expected_callback); schedule_event->Wait (wait_interval); int call_time = Scheduler::getTime(); printf ("Event Late by %u\r\n", call_time - expected_callback);

Before my GUI displays objects, I get a late time of between 1 and 5, which is quite acceptable.
When My objects are displayed and I start the MIDI notes, I start getting longer delays. If I minimise my GUI, the timing is rock solid again. This means that it must have to do with the way I am implementing the update in Java in that it is not giving my pthreads enough priority.


--
Angelo Fraietta

PO Box 859
Hamilton NSW 2303

Home Page


http://www.users.bigpond.com/angelo_f/

There are those who seek knowledge for the sake of knowledge - that is CURIOSITY
There are those who seek knowledge to be known by others - that is VANITY
There are those who seek knowledge in order to serve - that is LOVE
   Bernard of Clairvaux (1090 - 1153)



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Mt-smp mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Delayed Events (From: Angelo Fraietta <email@hidden>)
 >Re: Delayed Events (From: Philippe Wicker <email@hidden>)
 >Re: Delayed Events (From: Philippe Wicker <email@hidden>)
 >Re: Delayed Events (From: Angelo Fraietta <email@hidden>)
 >Re: Delayed Events (From: Philippe Wicker <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.