3 #include "threads-model.h"
7 /* global "model" object */
11 * User program API functions
13 int thrd_create(thrd_t *t, thrd_start_t start_routine, void *arg)
15 createModelIfNotExist();
16 struct thread_params params = { start_routine, arg };
17 /* seq_cst is just a 'don't care' parameter */
18 model->switch_thread(new ModelAction(THREAD_CREATE, std::memory_order_seq_cst, t, (uint64_t)¶ms));
22 int thrd_join(thrd_t t)
24 createModelIfNotExist();
26 model->switch_thread(new ModelAction(THREAD_JOIN, std::memory_order_seq_cst, th, id_to_int(thrd_to_id(t))));
30 /** A no-op, for now */
33 createModelIfNotExist();
34 model->switch_thread(new ModelAction(THREAD_YIELD, std::memory_order_seq_cst, thread_current(), VALUE_NONE));
37 thrd_t thrd_current(void)
39 createModelIfNotExist();
40 return thread_current()->get_thrd_t();