#include "libthreads.h"
#include "schedule.h"
#include "common.h"
-#include "threads_internal.h"
+#include "threads.h"
/* global "model" object */
#include "model.h"
stack_free(stack);
}
-int Thread::switch_to_master(ModelAction *act)
-{
- Thread *next;
-
- DBG();
- model->set_current_action(act);
- state = THREAD_READY;
- next = model->system_thread;
- return swap(next);
-}
-
Thread::Thread(thrd_t *t, void (*func)(), void *a) {
int ret;
th = new Thread(&main_thread);
- /* Start user program */
- thrd_create(&user_thread, &user_main, NULL);
+ do {
+ /* Start user program */
+ thrd_create(&user_thread, &user_main, NULL);
+
+ /* Wait for all threads to complete */
+ thread_wait_finish();
- /* Wait for all threads to complete */
- thread_wait_finish();
+ model->print_trace();
+ } while (model->next_execution());
- model->print_trace();
delete th;
delete model;