vis, light: set low process priority on windows

This commit is contained in:
Eric Wasylishen 2015-08-02 18:48:06 -06:00
parent 5302a3b539
commit 3005504fe5
4 changed files with 15 additions and 0 deletions

View File

@ -82,6 +82,12 @@ InterruptThreadProgress__(void)
int numthreads = 1;
CRITICAL_SECTION crit;
void
LowerProcessPriority(void)
{
SetPriorityClass(GetCurrentProcess(), BELOW_NORMAL_PRIORITY_CLASS);
}
int
GetDefaultThreads(void)
{
@ -170,6 +176,12 @@ RunThreadsOn(int start, int workcnt, void *(func)(void *), void *arg)
int numthreads = 1;
pthread_mutex_t *my_mutex;
void
LowerProcessPriority(void)
{
/* not implemented for now */
}
int
GetDefaultThreads(void)
{

View File

@ -5,6 +5,7 @@
extern int numthreads;
void LowerProcessPriority(void);
int GetDefaultThreads(void);
int GetMaxThreads(void); /* returns 0 if no limit specified */
int GetThreadWork(void);

View File

@ -270,6 +270,7 @@ main(int argc, const char **argv)
init_log("light.log");
logprint("---- light / TyrUtils " stringify(TYRUTILS_VERSION) " ----\n");
LowerProcessPriority();
numthreads = GetDefaultThreads();
for (i = 1; i < argc; i++) {

View File

@ -1182,6 +1182,7 @@ main(int argc, char **argv)
init_log("vis.log");
logprint("---- vis / TyrUtils " stringify(TYRUTILS_VERSION) " ----\n");
LowerProcessPriority();
numthreads = GetDefaultThreads();
for (i = 1; i < argc; i++) {