libbarrelfish/threads: Provide thread_set_status to set return status of a thread
authorMoritz Hoffmann <moritz.hoffmann@inf.ethz.ch>
Fri, 14 Oct 2016 11:54:45 +0000 (13:54 +0200)
committerMoritz Hoffmann <moritz.hoffmann@inf.ethz.ch>
Fri, 14 Oct 2016 11:54:45 +0000 (13:54 +0200)
Signed-off-by: Moritz Hoffmann <moritz.hoffmann@inf.ethz.ch>

include/barrelfish/threads.h
lib/barrelfish/threads.c

index 0978736..9c0a00a 100644 (file)
@@ -115,6 +115,13 @@ static inline void thread_once(thread_once_t *control, void (*func)(void)) {
     }
 }
 
+/**
+ * \brief Set a thread's exit status.
+ *
+ * \param status The status.
+ */
+void thread_set_status(int status);
+
 __END_DECLS
 
 #endif  // LIBBARRELFISH_THREADS_H
index e52c26b..2663c23 100644 (file)
@@ -719,6 +719,11 @@ struct capref thread_get_next_recv_slot(void)
     return me->recv_slots[--me->recv_slot_count];
 }
 
+void thread_set_status(int status) {
+    struct thread *me = thread_self();
+    me->return_value = status;
+}
+
 /**
  * \brief Yield the calling thread
  *