X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=threads.cc;h=d00e21228295b0f9bc7f86902a2a9bfcc2577947;hb=d88196987e572dcb561e8b1eabb3409c4491d460;hp=1e2af8cbba16343349b91a90e2f87d5bd335631b;hpb=50f263af6b0ea0148dfaa1e527951c6b9022ff7f;p=model-checker.git diff --git a/threads.cc b/threads.cc index 1e2af8c..d00e212 100644 --- a/threads.cc +++ b/threads.cc @@ -22,6 +22,13 @@ Thread * thread_current(void) 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(); + curr_thread->start_routine(curr_thread->arg); +} + int Thread::create_context() { int ret; @@ -36,7 +43,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, arg); + makecontext(&context, thread_startup, 0); return 0; } @@ -61,15 +68,7 @@ void Thread::complete() } } -void * Thread::operator new(size_t size) { - return userMalloc(size); -} - -void Thread::operator delete(void *ptr) { - userFree(ptr); -} - -Thread::Thread(thrd_t *t, void (*func)(), void *a) { +Thread::Thread(thrd_t *t, void (*func)(void *), void *a) { int ret; user_thread = t;