model: make scheduler private
[model-checker.git] / threads.cc
index f24010697d60f306de512ab40fecdece88875cdd..ad88ad3602188e3fdb4d2089347ae004b03cadda 100644 (file)
@@ -26,7 +26,7 @@ static void stack_free(void *stack)
 Thread * thread_current(void)
 {
        ASSERT(model);
-       return model->scheduler->get_current_thread();
+       return model->get_current_thread();
 }
 
 /**
@@ -36,8 +36,8 @@ Thread * thread_current(void)
  * @todo We should make the START event always immediately follow the
  * CREATE event, so we don't get redundant traces...
  */
-
-void thread_startup() {
+void thread_startup()
+{
        Thread * curr_thread = thread_current();
 
        /* Add dummy "start" action, just to create a first clock vector */
@@ -71,11 +71,27 @@ int Thread::create_context()
        return 0;
 }
 
+/**
+ * Swaps the current context to another thread of execution. This form switches
+ * from a user Thread to a system context.
+ * @param t Thread representing the current context
+ * @param ctxt Context to switch to
+ * @return Does not return, unless we return to Thread t's context. See
+ * swapcontext(3) (returns 0 for success, -1 for failure).
+ */
 int Thread::swap(Thread *t, ucontext_t *ctxt)
 {
        return swapcontext(&t->context, ctxt);
 }
 
+/**
+ * Swaps the current context to another thread of execution. This form switches
+ * from a system context to a user Thread.
+ * @param t Thread representing the current context
+ * @param ctxt Context to switch to
+ * @return Does not return, unless we return to Thread t's context. See
+ * swapcontext(3) (returns 0 for success, -1 for failure).
+ */
 int Thread::swap(ucontext_t *ctxt, Thread *t)
 {
        return swapcontext(ctxt, &t->context);
@@ -83,7 +99,6 @@ int Thread::swap(ucontext_t *ctxt, Thread *t)
 
 
 /** Terminate a thread and free its stack. */
-
 void Thread::complete()
 {
        if (state != THREAD_COMPLETED) {