threads: set up Thread to be freed properly
[model-checker.git] / libthreads.cc
index 7ed5491f675fe91d646a8bec1d056ae712ea2ab3..86a95e63f7d83d73f81ac89197102b85ba410eb6 100644 (file)
@@ -1,6 +1,6 @@
 #include "libthreads.h"
 #include "common.h"
-#include "threads_internal.h"
+#include "threads.h"
 
 /* global "model" object */
 #include "model.h"
@@ -22,8 +22,9 @@ 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)
-               /* seq_cst is just a 'don't care' parameter */
-               ret = model->switch_to_master(new ModelAction(THREAD_JOIN, memory_order_seq_cst, NULL, VALUE_NONE));
+               ret = model->switch_to_master(NULL);
+       /* seq_cst is just a 'don't care' parameter */
+       ret = model->switch_to_master(new ModelAction(THREAD_JOIN, memory_order_seq_cst, NULL, VALUE_NONE));
        return ret;
 }