threads: trivial change
[model-checker.git] / threads.cc
index f24010697d60f306de512ab40fecdece88875cdd..26975799f0adc03ce8ca4e0ad6e391aad0e37d96 100644 (file)
@@ -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) {