Skip to content
Snippets Groups Projects
Commit e005a738 authored by Glauber Costa's avatar Glauber Costa Committed by Avi Kivity
Browse files

sched: add a new thread state, prestarted


It may be that a thread that is initialized early is also started early. We need to
somehow mark that thread as already started, so we can start it for real later when
the scheduler is ready to go. We will do this by adding an extra state, prestarted.

Later on, we will take action to start those threads properly.

Signed-off-by: default avatarGlauber Costa <glommer@cloudius-systems.com>
Reviewed-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
Signed-off-by: default avatarAvi Kivity <avi@cloudius-systems.com>
parent d6ea366f
No related branches found
No related tags found
No related merge requests found
......@@ -486,10 +486,16 @@ thread::~thread()
void thread::start()
{
assert(_status == status::unstarted);
if (!sched::s_current) {
_status.store(status::prestarted);
return;
}
_cpu = _attr.pinned_cpu ? _attr.pinned_cpu : current()->tcpu();
remote_thread_local_var(percpu_base) = _cpu->percpu_base;
remote_thread_local_var(current_cpu) = _cpu;
assert(_status == status::unstarted);
_status.store(status::waiting);
wake();
}
......
......@@ -245,6 +245,7 @@ private:
thread_control_block* _tcb;
enum class status {
invalid,
prestarted,
unstarted,
waiting,
running,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment