threads: add flag for a special type of "model-checker thread"
[c11tester.git] / threads.cc
index 836bf2c72a7056923c4d3c09865076bb5fe9caef..e1f74bfbd210da803259b09300ca15f5db3f964e 100644 (file)
 /** Allocate a stack for a new thread. */
 static void * stack_allocate(size_t size)
 {
-       return malloc(size);
+       return snapshot_malloc(size);
 }
 
 /** Free a stack for a terminated thread. */
 static void stack_free(void *stack)
 {
-       free(stack);
+       snapshot_free(stack);
 }
 
 /** Return the currently executing thread. */
@@ -105,7 +105,7 @@ int Thread::swap(ucontext_t *ctxt, Thread *t)
 void Thread::complete()
 {
        if (!is_complete()) {
-               DEBUG("completed thread %d\n", get_id());
+               DEBUG("completed thread %d\n", id_to_int(get_id()));
                state = THREAD_COMPLETED;
                if (stack)
                        stack_free(stack);
@@ -126,7 +126,8 @@ Thread::Thread(thrd_t *t, void (*func)(void *), void *a) :
        user_thread(t),
        state(THREAD_CREATED),
        wait_list(),
-       last_action_val(VALUE_NONE)
+       last_action_val(VALUE_NONE),
+       model_thread(false)
 {
        int ret;