|
From: Hans D. <dul...@us...> - 2001-03-20 04:06:54
|
Update of /cvsroot/corelinux/corelinux/src/classlibs/corelinux
In directory usw-pr-cvs1:/tmp/cvs-serv5036
Modified Files:
Environment.cpp Thread.cpp
Log Message:
Added methods for handling thread priority
Index: Environment.cpp
===================================================================
RCS file: /cvsroot/corelinux/corelinux/src/classlibs/corelinux/Environment.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** Environment.cpp 2000/09/24 02:34:20 1.3
--- Environment.cpp 2001/03/20 04:09:11 1.4
***************
*** 33,36 ****
--- 33,37 ----
#include <unistd.h>
#include <sys/types.h>
+ #include <sys/resource.h>
#include <errno.h>
#include <stdlib.h>
***************
*** 119,123 ****
if( stret == -1 )
{
! errRet = Thread::getKernelError();
//
--- 120,124 ----
if( stret == -1 )
{
! errRet = Int(*__errno_location());
//
***************
*** 201,204 ****
--- 202,215 ----
return stret;
+ }
+
+ void Environment::setThreadPriority ( ProcessIdentifier pid, Int prio )
+ {
+ setpriority (PRIO_PROCESS, pid, prio);
+ }
+
+ Int Environment::getThreadPriority ( ProcessIdentifier pid )
+ {
+ return getpriority (PRIO_PROCESS, pid);
}
}
Index: Thread.cpp
===================================================================
RCS file: /cvsroot/corelinux/corelinux/src/classlibs/corelinux/Thread.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -r1.17 -r1.18
*** Thread.cpp 2001/03/17 04:29:01 1.17
--- Thread.cpp 2001/03/20 04:09:11 1.18
***************
*** 27,30 ****
--- 27,31 ----
#include <signal.h>
#include <sched.h>
+ #include <sys/resource.h>
}
***************
*** 347,350 ****
--- 348,352 ----
{
theThreadMap[aThreadId] = aContextPtr;
+ aContextPtr->setThreadState ( THREAD_RUNNING );
theThreadCount++;
}
***************
*** 423,426 ****
--- 425,446 ----
theThreadMap.erase( aTCItr );
+ }
+
+ // Get thread priority
+
+ Int Thread::getThreadPriority(ThreadIdentifierCref anId)
+ throw ( InvalidThreadException, Assertion )
+ {
+ ThreadContextCref aContext( Thread::getThreadContext( anId ) );
+ return Environment::getThreadPriority( aContext.getIdentifier() );
+ }
+
+ // Set thread priority
+
+ void Thread::setThreadPriority(ThreadIdentifierCref anId, Int prio)
+ throw ( InvalidThreadException, Assertion )
+ {
+ ThreadContextCref aContext( Thread::getThreadContext( anId ) );
+ Environment::setThreadPriority(aContext.getIdentifier(), prio);
}
|