I was thinking about trying mutex or monitor commands but .... well they
lock an object ... and I don't really need to lock any object, just need
with.
And second, the callback is a high level (non member) function ... and
I can't declare a global mutex ... nor is the audio buffer a global object
..... hmmmm.
How is it that programs like cakewalk/pro studio .... pro recording
deal with this ..... there has to be a way to ensure that the program will
In article <3A57A2C0-D1EE-42AC-B339-67BF88FA2C01@microsoft.com>,
=?Utf-8?B?QWFyb24=?= <Aaron@discussions.microsoft.com> wrote:
Simple question:
I have a callback function that gets interrupted by something
...... I check the system time before and after a particular
operation ... it usually takes ~150000 ticks ..... but once in a
while it takes much longer. It is a single operation .... reading a
buffer (which is not locked) .......
Simple question, tough answer. The short summary of the answer is
'deal with it.' The longer version of the answer is that Windows is
*not* a realtime operating system, where things can be guaranteed to
happen. All sorts of things -- from other threads to disk access
(memory swapped out, etc) can demand processor time. If you pull up
the task manager (hit ctrl-alt-delete, and pick 'Task Manager') you
can easily see what processes are using CPU time. You can also see
which processes are hitting the disk, though you may need to enable
other columns.
Programatically, the SetThreadPriority function -- see articles
like http://msdn2.microsoft.com/en-us/library/ms686277.aspx for how to
adjust things. However, if you're using this to set things to anything
higher than THREAD_PRIORITY_ABOVE_NORMAL, you're being *very*
unfriendly to other apps. I wouldn't want to run any apps that
misbehave in that way. Basically, if you're only running this app on
your home system, higher priorities are acceptable. Please don't
inflict such code on anyone else.
Nathan Mates
--
<*> Nathan Mates - personal webpage http://www.visi.com/~nathan/
# Programmer at Pandemic Studios -- http://www.pandemicstudios.com/
# NOT speaking for Pandemic Studios. "Care not what the neighbors
# think. What are the facts, and to how many decimal places?" -R.A.
Heinlein