trivial changes
[c11tester.git] / threads.cc
index 0ed7bdcabc084eabf0755c8df098b724d3c023c4..6d290a94f9f2131b5ca9e7d47b8bae457dd02857 100644 (file)
@@ -1,5 +1,3 @@
-/* -*- Mode: C; indent-tabs-mode: t -*- */
-
 #include "libthreads.h"
 #include "common.h"
 #include "threads.h"
 
 static void * stack_allocate(size_t size)
 {
-       return userMalloc(size);
+       return malloc(size);
 }
 
 static void stack_free(void *stack)
 {
-       userFree(stack);
+       free(stack);
 }
 
 Thread * thread_current(void)
 {
+       ASSERT(model);
        return model->scheduler->get_current_thread();
 }
 
 /* This method just gets around makecontext not being 64-bit clean */
 
 void thread_startup() {
-       Thread * curr_thread=thread_current();
+       Thread * curr_thread = thread_current();
        curr_thread->start_routine(curr_thread->arg);
 }
 
@@ -45,7 +44,7 @@ int Thread::create_context()
        context.uc_stack.ss_size = STACK_SIZE;
        context.uc_stack.ss_flags = 0;
        context.uc_link = model->get_system_context();
-       makecontext(&context, start_routine, 1);
+       makecontext(&context, thread_startup, 0);
 
        return 0;
 }
@@ -70,7 +69,7 @@ void Thread::complete()
        }
 }
 
-Thread::Thread(thrd_t *t, void (*func)(), void *a) {
+Thread::Thread(thrd_t *t, void (*func)(void *), void *a) {
        int ret;
 
        user_thread = t;