Avoiding timing errors when using WaitBlanking with Windows

Running Windows 2000 and Matlab 5.3, a call to Screen's
WaitBlanking function can sometimes take two or more screen refreshes
to finish, when it is only supposed to take one. On the machines we
use at the Penn Visual Perception lab, we need to do three things to
get rid of this problem: Quit open applications and non-Matlab
windows (obviously), turn off the Local Area Network (LAN), and set
the priority of Matlab.exe to high (under "processes" in the Windows
Task Manager). This seems to eliminate the incidence of extra
refreshes when using WaitBlanking.

Setting Matlab's priority under Windows to "realtime" also gets rid
of the extra refreshes, but prevents getchar and kbCheck from
reliably detecting keypresses.

--Dan
dmatza@...
I've tried your solution of setting matlab.exe to "high" in the task
manager. This works for making my program experiment run seamlessly.
However, I've noticed after about 1-2 minutes, the program runs as
sluggishly as it did before when priority was "normal". Lo and
behold, when I go check the task manager, matlab.exe has been reset
back to normal priority. Any ideas why this is happening and how I
can fix it? Is matlab overriding the priority change or is a windows
component doing it?

general specs:
PTB 3.0
Matlab 7.1
windows xp

really detailed specs:
Dell Inc.
System Model: Precision WorkStation 390
BIOS Version: Dell Inc. 1.0.5
Microsoft Windows XP Professional
Version: 5.1.2600
Service Pack: 2.0

Intel(R) Core(TM)2 CPU 6400 @ 2.13GHz
Version: x86 Family 6 Model 15 Stepping 6
Speed: 2128 MHz
Intel(R) Core(TM)2 CPU 6400 @ 2.13GHz
Version: x86 Family 6 Model 15 Stepping 6
Speed: 2128 MHz