1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Tune queue limits, some other adjustments

This commit is contained in:
kwolekr 2013-02-21 17:44:14 -05:00
parent 67c59645ec
commit 60e6284f30
4 changed files with 174 additions and 29 deletions

View file

@ -46,8 +46,33 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#else
#include <unistd.h>
#include <stdint.h> //for uintptr_t
#if defined(linux) || defined(__linux)
#define _GNU_SOURCE
#endif
#include <sched.h>
#ifdef __FreeBSD__
#include <pthread_np.h>
typedef cpuset_t cpu_set_t;
#elif defined(__sun) || defined(sun)
#include <sys/types.h>
#include <sys/processor.h>
#elif defined(_AIX)
#include <sys/processor.h>
#elif __APPLE__
#include <mach/mach_init.h>
#include <mach/thread_policy.h>
#endif
#define sleep_ms(x) usleep(x*1000)
#define THREAD_PRIORITY_LOWEST 0
#define THREAD_PRIORITY_BELOW_NORMAL 1
#define THREAD_PRIORITY_NORMAL 2
#define THREAD_PRIORITY_ABOVE_NORMAL 3
#define THREAD_PRIORITY_HIGHEST 4
#endif
#ifdef _MSC_VER
@ -108,6 +133,16 @@ void initializePaths();
*/
int getNumberOfProcessors();
/*
Set a thread's affinity to a particular processor.
*/
bool threadBindToProcessor(threadid_t tid, int pnumber);
/*
Set a thread's priority.
*/
bool threadSetPriority(threadid_t tid, int prio);
/*
Resolution is 10-20ms.
Remember to check for overflows.