public static int do_dispatch(){
{
int prior = this.getPriority();
ThreadCB threadToDispatch=null;
ThreadCB runningThread=null;
TaskCB runningTask=null;
try {
runningTask = MMU.getPTBR().getTask();
runningThread = runningTask.getCurrentThread();
} catch(NullPointerException e) {}
// If necessary, remove current thread from processor and reschedule it.
if(runningThread != null)
{
// Check if quantum is exceeded
if (HTimer.get() < 1)
{
//Increment the priority to lower priority value
prior++;
this.setPriority(prior);
}
//Append to expired
expired[prior].append(this);
runningTask.setCurrentThread(null);
MMU.setPTBR(null);
runningThread.setStatus(ThreadReady);
readyQueue.append(runningThread);
Another example:
class Sub {
static int y;
public static void foo() {
this.y = 10;
}
}
I'm attempting to compile my program but I continue to get errors with the use of the this keyword in this situation. I understand that 'this' represents the object invoking the method and that static methods are not bound to any object.
What would be the correct way to implement 'this'?