mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-10-06 00:30:10 -06:00
Core: CoWork now using 'nice' priority
git-svn-id: svn://ultimatepp.org/upp/trunk@11823 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
f3c5d910ea
commit
5a05f77912
6 changed files with 215 additions and 107 deletions
|
|
@ -158,6 +158,24 @@ bool Thread::Run(Function<void ()> _cb, bool noshutdown)
|
|||
return handle;
|
||||
}
|
||||
|
||||
bool Thread::RunNice(Function<void ()> cb, bool noshutdown)
|
||||
{
|
||||
if(Run(cb, noshutdown)) {
|
||||
Nice();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Thread::RunCritical(Function<void ()> cb, bool noshutdown)
|
||||
{
|
||||
if(Run(cb, noshutdown)) {
|
||||
Critical();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Thread::~Thread()
|
||||
{
|
||||
Detach();
|
||||
|
|
@ -363,6 +381,22 @@ void Thread::Start(Function<void ()> cb, bool noshutdown)
|
|||
t.Detach();
|
||||
}
|
||||
|
||||
void Thread::StartNice(Function<void ()> cb, bool noshutdown)
|
||||
{
|
||||
Thread t;
|
||||
t.Run(cb);
|
||||
t.Nice();
|
||||
t.Detach();
|
||||
}
|
||||
|
||||
void Thread::StartCritical(Function<void ()> cb, bool noshutdown)
|
||||
{
|
||||
Thread t;
|
||||
t.Run(cb);
|
||||
t.Critical();
|
||||
t.Detach();
|
||||
}
|
||||
|
||||
void Thread::Sleep(int msec)
|
||||
{
|
||||
#ifdef PLATFORM_WIN32
|
||||
|
|
|
|||
Loading…
Reference in a new issue