From: Brian Norris <banorris@uci.edu>
Date: Fri, 13 Jul 2012 05:18:25 +0000 (-0700)
Subject: libthreads: thrd_join() always return 0
X-Git-Tag: pldi2013~354
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=cb5fb31052d5e3dbb01f65d12988bafa1ce51cf7;p=model-checker.git

libthreads: thrd_join() always return 0

According to the spec, thrd_join() should return the return code from the
joining thread function. But for now, I implement the function type
(thrd_start_t, from C11) as returning void, not int. So just return 0 always.
---

diff --git a/libthreads.cc b/libthreads.cc
index a414686..c54c9aa 100644
--- a/libthreads.cc
+++ b/libthreads.cc
@@ -23,11 +23,10 @@ int thrd_create(thrd_t *t, thrd_start_t start_routine, void *arg)
 
 int thrd_join(thrd_t t)
 {
-	int ret = 0;
 	Thread *th = model->get_thread(thrd_to_id(t));
-	while (th->get_state() != THREAD_COMPLETED && !ret)
-		ret = model->switch_to_master(NULL);
-	return ret;
+	while (th->get_state() != THREAD_COMPLETED)
+		model->switch_to_master(NULL);
+	return 0;
 }
 
 int thrd_yield(void)