File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -98,17 +98,24 @@ MK_NOINLINE void KThreadSwitchTo(KThread* t, PPCIrqState st)
9898
9999void KThreadResume (KThread * t )
100100{
101+ KThread * self = KThreadGetSelf ();
101102 PPCIrqState st = PPCIrqLockByMsr ();
102103
103- if (!t -> suspend || (-- t -> suspend )) {
104+ if (!t -> suspend || (-- t -> suspend ) || t -> wait . queue ) {
104105 PPCIrqUnlockByMsr (st );
105106 return ;
106107 }
107108
108- if (!t -> wait .queue ) {
109- t -> state = KTHR_STATE_RUNNING ;
109+ t -> state = KTHR_STATE_RUNNING ;
110+
111+ if (t != self ) {
110112 KThreadReschedule (t , st );
111113 } else {
114+ // We are assuming 1) PPCIsInExcpt, 2) KThreadSuspend(self) was called before, and thus 3) __ppc_next_ctx != NULL
115+ if (t -> prio < __ppc_next_ctx -> prio ) {
116+ __ppc_next_ctx = NULL ;
117+ }
118+
112119 PPCIrqUnlockByMsr (st );
113120 }
114121}
You can’t perform that action at this time.
0 commit comments