Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

emmai

realtime priority???

This topic is 5211 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''d like my code running at RealTime priority, I do it like this
DWORD dwOldProcessP = GetPriorityClass(GetCurrentProcess());
DWORD dwOldThreadP = GetThreadPriority(GetCurrentThread());
SetPriorityClass(GetCurrentProcess(), REALTIME_PRIORITY_CLASS);
SetThreadPriority(GetCurrentThread(),THREAD_PRIORITY_TIME_CRITICAL);
//

//...some instructions

//

SetThreadPriority(GetCurrentThread(), dwOldThreadP);
SetPriorityClass(GetCurrentProcess(), dwOldProcessP);
it does works on a AMD 2200+ cpu,when the instauctions been executed,I can''t move the mouse, but on a P4 2.4c cpu,it seems not running at Realtime priority,I can move my mouse or alt+tab to another apps,just like the instructions is running at normal priority!!! All OS is win2000 pro+sp4! can u tell me why this happened?thanks!

Share this post


Link to post
Share on other sites
Advertisement
Yea...don''t run at RealTime priority. When you do that, your app has greater priority than even the operating system, and those mouse events are never even being fired.

Share this post


Link to post
Share on other sites
but on a P4 2.4c cpu,it seems NOT running at Realtime priority,I can move my mouse or alt+tab to another apps,just like the instructions is running at normal priority!!!

Share this post


Link to post
Share on other sites
quote:
Original post by SiCrane
Does the P4 2.4 you were using have hyperthreading?


yes!!!any ideas?

Share this post


Link to post
Share on other sites
If you have hyperthreading, then that means that you have two logical CPUs. One of the logical CPUs runs your real-time thread; the other runs the mouse movement thread (and other threads wanting to run).

If you create two threads and make them both real-time, it''ll block out both CPUs.

Note that regular user accounts may or may not be able to set their process as real time class.

Share this post


Link to post
Share on other sites
quote:
Original post by hplus0603
If you have hyperthreading, then that means that you have two logical CPUs. One of the logical CPUs runs your real-time thread; the other runs the mouse movement thread (and other threads wanting to run).

If you create two threads and make them both real-time, it''ll block out both CPUs.

Note that regular user accounts may or may not be able to set their process as real time class.


thanks a lot

Share this post


Link to post
Share on other sites
If you are trying to implement a high-frequency callback function (only reason I could see to use a realtime thread) and you want your code to run on machines with only one CPU, use the Windows multimedia timers. That is what we do in our haptics class to update the forcefeedback at 1000 Hz.

----------------------------------------
Let be be finale of seem, seems to me.
----------------------------------------

Shedletsky''s Code Library:

Open source projects and demos

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!