2014-04-27 01:26:08 +02:00
|
|
|
#ifndef __COMPAT_H__
|
|
|
|
#define __COMPAT_H__
|
|
|
|
|
|
|
|
#ifdef WIN32
|
|
|
|
|
|
|
|
#include <windows.h>
|
|
|
|
|
2015-01-22 02:02:33 +01:00
|
|
|
extern int opt_priority;
|
|
|
|
|
2014-04-27 01:26:08 +02:00
|
|
|
static __inline void sleep(int secs)
|
|
|
|
{
|
|
|
|
Sleep(secs * 1000);
|
|
|
|
}
|
|
|
|
|
|
|
|
enum {
|
2015-01-22 02:02:33 +01:00
|
|
|
PRIO_PROCESS = 0,
|
2014-04-27 01:26:08 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
static __inline int setpriority(int which, int who, int prio)
|
|
|
|
{
|
2015-01-22 02:02:33 +01:00
|
|
|
switch (opt_priority) {
|
|
|
|
case 5:
|
|
|
|
prio = THREAD_PRIORITY_TIME_CRITICAL;
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
prio = THREAD_PRIORITY_HIGHEST;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
prio = THREAD_PRIORITY_ABOVE_NORMAL;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
prio = THREAD_PRIORITY_NORMAL;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
prio = THREAD_PRIORITY_BELOW_NORMAL;
|
|
|
|
break;
|
|
|
|
case 0:
|
|
|
|
default:
|
|
|
|
prio = THREAD_PRIORITY_IDLE;
|
|
|
|
}
|
|
|
|
return -!SetThreadPriority(GetCurrentThread(), prio);
|
2014-04-27 01:26:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* WIN32 */
|
|
|
|
|
|
|
|
#endif /* __COMPAT_H__ */
|