From: falcovorbis <fal...@us...> - 2024-07-15 22:45:51
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via a03ea3dc765c332ae2b1263ad2c87143a4c69ac3 (commit) from 15115fbf34867109f2e73fb066d8eeee5d70320c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit a03ea3dc765c332ae2b1263ad2c87143a4c69ac3 Author: Donald Haase <qu...@ya...> Date: Mon Jul 15 18:45:26 2024 -0400 Ensure thd_current does not get set to null (#674) * Remove the use of setting thd_current to null to signal wait. As this also was only happening when the thread state was being set to STATE_WAIT, the checks against it were always pointless due to being followed by testing against STATE_RUNNING. The dontenq variable can be removed entirely due to this. I can only imagine that this predated the state system. * Remove accidentally added includes to genwait. --------- Co-authored-by: QuzarDC <qu...@co...> ----------------------------------------------------------------------- Summary of changes: kernel/thread/genwait.c | 1 - kernel/thread/thread.c | 9 ++------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/kernel/thread/genwait.c b/kernel/thread/genwait.c index 64285666..da50dbb2 100644 --- a/kernel/thread/genwait.c +++ b/kernel/thread/genwait.c @@ -81,7 +81,6 @@ int genwait_wait(void * obj, const char * mesg, int timeout, void (*callback)(vo /* Prepare us for sleep */ me = thd_current; - thd_current = NULL; me->state = STATE_WAIT; me->wait_obj = obj; me->wait_msg = mesg; diff --git a/kernel/thread/thread.c b/kernel/thread/thread.c index b7b360dd..5fe46097 100644 --- a/kernel/thread/thread.c +++ b/kernel/thread/thread.c @@ -660,16 +660,11 @@ static void thd_update_cpu_time(kthread_t *thd) { don't want a full context switch inside the same priority group. */ void thd_schedule(bool front_of_line, uint64_t now) { - int dontenq; kthread_t *thd; if(now == 0) now = timer_ms_gettime64(); - /* We won't re-enqueue the current thread if it's NULL (i.e., the - thread blocked itself somewhere) or if it's a zombie (below) */ - dontenq = !thd_current; - /* If there's only two thread left, it's the idle task and the reaper task: exit the OS */ if(thd_count == 2) { @@ -679,7 +674,7 @@ void thd_schedule(bool front_of_line, uint64_t now) { /* If the current thread is supposed to be in the front of the line, and it did not die, re-enqueue it to the front of the line now. */ - if(front_of_line && !dontenq && thd_current->state == STATE_RUNNING) { + if(front_of_line && thd_current->state == STATE_RUNNING) { thd_current->state = STATE_READY; thd_add_to_runnable(thd_current, front_of_line); } @@ -698,7 +693,7 @@ void thd_schedule(bool front_of_line, uint64_t now) { /* If we didn't already re-enqueue the thread and we are supposed to do so, do it now. */ - if(!front_of_line && !dontenq && thd_current->state == STATE_RUNNING) { + if(!front_of_line && thd_current->state == STATE_RUNNING) { thd_current->state = STATE_READY; thd_add_to_runnable(thd_current, front_of_line); hooks/post-receive -- A pseudo Operating System for the Dreamcast. |