Skip to content

Commit

Permalink
Add thread_run_flash() helper
Browse files Browse the repository at this point in the history
(cherry picked from commit af928fd)
  • Loading branch information
kostikbel committed May 10, 2021
1 parent 5771601 commit 8e1c742
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
25 changes: 25 additions & 0 deletions sys/kern/kern_thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -1514,6 +1514,31 @@ thread_unsuspend_one(struct thread *td, struct proc *p, bool boundary)
return (setrunnable(td, 0));
}

void
thread_run_flash(struct thread *td)
{
struct proc *p;

p = td->td_proc;
PROC_LOCK_ASSERT(p, MA_OWNED);

if (TD_ON_SLEEPQ(td))
sleepq_remove_nested(td);
else
thread_lock(td);

THREAD_LOCK_ASSERT(td, MA_OWNED);
KASSERT(TD_IS_SUSPENDED(td), ("Thread not suspended"));

TD_CLR_SUSPENDED(td);
PROC_SLOCK(p);
MPASS(p->p_suspcount > 0);
p->p_suspcount--;
PROC_SUNLOCK(p);
if (setrunnable(td, 0))
kick_proc0();
}

/*
* Allow all threads blocked by single threading to continue running.
*/
Expand Down
1 change: 1 addition & 0 deletions sys/sys/proc.h
Original file line number Diff line number Diff line change
Expand Up @@ -1179,6 +1179,7 @@ void thread_stopped(struct proc *p);
void childproc_stopped(struct proc *child, int reason);
void childproc_continued(struct proc *child);
void childproc_exited(struct proc *child);
void thread_run_flash(struct thread *td);
int thread_suspend_check(int how);
bool thread_suspend_check_needed(void);
void thread_suspend_switch(struct thread *, struct proc *p);
Expand Down

0 comments on commit 8e1c742

Please sign in to comment.