model: set thread state during 'swap' calls
[c11tester.git] / threads.cc
index 6adc053ae2dbfc58a00bbbb2f0e6a7c2e79a7b4c..9de580297871687e4529f2a67512aa6087a9cc1b 100644 (file)
@@ -84,6 +84,7 @@ int Thread::create_context()
  */
 int Thread::swap(Thread *t, ucontext_t *ctxt)
 {
+       t->set_state(THREAD_READY);
        return swapcontext(&t->context, ctxt);
 }
 
@@ -97,6 +98,7 @@ int Thread::swap(Thread *t, ucontext_t *ctxt)
  */
 int Thread::swap(ucontext_t *ctxt, Thread *t)
 {
+       t->set_state(THREAD_RUNNING);
        return swapcontext(ctxt, &t->context);
 }