Created
August 5, 2014 07:28
-
-
Save PathogenDavid/6c678eb38532eb07179d to your computer and use it in GitHub Desktop.
tsk_switch_handler
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void tsk_switch_handler() | |
{ | |
tm_current_slice--; //609 | |
if (tm_current_slice == 0) //610 | |
{ | |
//Timeslice exhausted, switch to another thread as long as we can get access to the kernel critical section... | |
if (kernel_critical_section) //612, 613 | |
{ | |
//Thread is in kernel critical section, so we give the thread | |
//some extra time to leave it. (We can't do anything until it | |
//does.) (This usually means the thread is running execi.) | |
tm_current_slice = 1; //614-615 | |
} | |
else | |
{ | |
//Thread is ready to be switched! | |
//sys_switch: //617 | |
tm_switcher_vector(); //This calls tm_switcher via function ptr.//618,619 | |
} | |
} | |
//Else, we don't do anything since the thread still has time to run. //624, sys_noswitch | |
return; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment