Commit 59d0341c authored by thomas's avatar thomas
Browse files

no message


git-svn-id: https://svn.grrrr.org/ext/trunk@193 4d9ac71a-51e6-0310-8455-cad1006bcd31
parent 25379407
......@@ -367,6 +367,11 @@ public:
;
#endif
int GetPriority();
void SetPriority(int p);
void RaisePriority() { SetPriority(GetPriority()+1); }
void LowerPriority() { SetPriority(GetPriority()-1); }
class ThrMutex
{
public:
......
......@@ -18,6 +18,10 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#include <sched.h>
#endif
#ifdef NT
#include <windows.h>
#endif
bool flext_base::StartThread(void *(*meth)(thr_params *p),thr_params *p,char *methname)
{
#ifdef _DEBUG
......@@ -88,6 +92,37 @@ void flext_base::YTick(flext_base *th) {
}
#endif
int flext_base::GetPriority()
{
#ifdef NT
HANDLE thr = GetCurrentThread();
return GetThreadPriority(thr);
#else
int policy;
sched_param parm;
pthread_getschedparam(pthread_self(),&policy,&parm);
return parm.sched_priority;
#endif
}
void flext_base::SetPriority(int p)
{
#ifdef NT
HANDLE thr = GetCurrentThread();
SetThreadPriority(thr,p);
#else
int policy = 0;
sched_param parm;
parm.sched_priority = 0;
if(pthread_setschedparam(pthread_self(),policy,&parm)) {
post("%s - failed to change priority",thisName());
}
#endif
}
class flext_base::qmsg
{
public:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment