make thread work when system is not busy

Vadim Zeitlin vadim at wxwidgets.org
Mon Sep 3 15:49:35 PDT 2007


On Sun, 02 Sep 2007 20:50:45 +0300 Christos Gourdoupis <nospam at thank.yu> wrote:

CG> The wrong thing is that, according to the manual, wxThread::SetPriority() "can
CG> only be set after calling Create() but before calling Run()" which implies that
CG> it should be called from the parent process. 
CG> Thus it sets the priority of the parent process!

 Looking at the code, SetPriority() should in fact be called before
Create() and not only before Run(). If it's called on a running thread then
it indeed just changes the priority of the current thread instead which is
questionably useful...

CG> Furthermore, if it's called from within the child process we come
CG> across another bug: Whatever value is given as the new priority, it
CG> always sets it to nice 19. I suspect the problem is in threadpsx.cpp in
CG> the following line:
CG> 
CG>             if ( setpriority(PRIO_PROCESS, 0, -(2*prio)/5 + 20) == -1 )
CG> 
CG> Perhaps it has something to do with "prio" being "unsigned int"?

 Indeed, the resulting expression is still unsigned... Fixed now, thanks,
VZ

-- 
TT-Solutions: wxWidgets consultancy and technical support
               http://www.tt-solutions.com/





More information about the wx-users mailing list