int thrd_create(thrd_t *t, thrd_start_t start_routine, void *arg)
{
Thread *thread;
- int ret;
DBG();
thread = new Thread(t, start_routine, arg);
- ret = model->add_thread(thread);
+ model->add_thread(thread);
DEBUG("create thread %d\n", id_to_int(thrd_to_id(*t)));
/* seq_cst is just a 'don't care' parameter */
model->switch_to_master(new ModelAction(THREAD_CREATE, std::memory_order_seq_cst, thread, VALUE_NONE));
- return ret;
+ return 0;
}
int thrd_join(thrd_t t)
printf("\n");
}
-int ModelChecker::add_thread(Thread *t)
+/**
+ * Add a Thread to the system for the first time. Should only be called once
+ * per thread.
+ * @param t The Thread to add
+ */
+void ModelChecker::add_thread(Thread *t)
{
thread_map->put(id_to_int(t->get_id()), t);
scheduler->add_thread(t);
- return 0;
}
void ModelChecker::remove_thread(Thread *t)
Thread * schedule_next_thread();
- int add_thread(Thread *t);
+ void add_thread(Thread *t);
void remove_thread(Thread *t);
Thread * get_thread(thread_id_t tid) { return thread_map->get(id_to_int(tid)); }