Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Author
Message
NickH
18
Years of Service
User Offline
Joined: 19th May 2008
Location: Nova Prospekt, North Yorks, UK
Posted: 7th May 2010 22:06
Hi,

Just wondering how I'd go about making a program run at a desired priority? For instance to make a program run at a slightly less than normal priority so it doesn't kill the system, but without manually going into the task manager each time.
Serge Adjo
19
Years of Service
User Offline
Joined: 3rd Aug 2006
Location:
Posted: 7th May 2010 22:43 Edited at: 7th May 2010 22:44
@NickH, I don't think it's possible yet! if such a command exist, the command would be in the '23. SYSTEM COMMANDS' section of the help files...

Serial Velocity
17
Years of Service
User Offline
Joined: 24th Aug 2008
Location:
Posted: 7th May 2010 22:54 Edited at: 7th May 2010 23:55
I'm sure you can use the DLL functions to call the functions "SetPriorityClass" and "GetCurrentProcess" from kernel32.dll.

EDIT - See my other post below.

IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 7th May 2010 22:57
Why bother?

Simply use the 'SYNC SLEEP 1' command, then SYNC often - rather than use up 100% of a processor core, your DBPro program will use only what it needs.

NickH
18
Years of Service
User Offline
Joined: 19th May 2008
Location: Nova Prospekt, North Yorks, UK
Posted: 7th May 2010 23:06 Edited at: 7th May 2010 23:09
@IanM
Hmm I hadn't noticed that command, thanks. I had thought about using your ticker commands to acheive something similar.

Just been curious about the priority thing for a while, though I'm not developing anything to use it right now
sladeiw
17
Years of Service
User Offline
Joined: 16th May 2009
Location: UK
Posted: 7th May 2010 23:45
Using bluegui I have found that if I use sleep or nice wait commands it introduces a small but annoying `lag` to the gadgets, especially when clicking on buttons, but that's just bluegui I think.

Below sets current (your) process priority but sync sleep 1 is definitely easier!

Serial Velocity
17
Years of Service
User Offline
Joined: 24th Aug 2008
Location:
Posted: 7th May 2010 23:54
Damn, sladeiw beat me to it .

Here's the code anyway, its more simple than sladeiw's code though:



NickH
18
Years of Service
User Offline
Joined: 19th May 2008
Location: Nova Prospekt, North Yorks, UK
Posted: 8th May 2010 02:42
OOo interesting! Thanks sladeiw & Serial Velocity. I'll give that a try tomorrow

Just curious about DB's application making patential after all my games development
NickH
18
Years of Service
User Offline
Joined: 19th May 2008
Location: Nova Prospekt, North Yorks, UK
Posted: 18th May 2010 13:30 Edited at: 18th May 2010 17:46
I've used both the lower priority and the Sync Sleep which works great. Is there a function in there that can control all the different volumes? I could do with a lesson in how to use these DLLs one day I think!

EDIT - I know this isn't related to the initial thread. (By volumes I mean audio)...thanks

Login to post a reply

Server time is: 2026-07-25 17:31:11
Your offset time is: 2026-07-25 17:31:11