We need to use functions with no arguments (i.e., 'void (*)()') in order to
retain strict type-checking with makecontext(). Of course, we still circumvent
this type checking with casting, but we should straighten this out sometime...
/*
* User program API functions
*/
-int thread_create(struct thread *t, void (*start_routine), void *arg)
+int thread_create(struct thread *t, void (*start_routine)(), void *arg)
{
int ret = 0;
} thread_state;
struct thread {
- void (*start_routine);
+ void (*start_routine)();
void *arg;
ucontext_t context;
void *stack;
thread_state state;
};
-int thread_create(struct thread *t, void (*start_routine), void *arg);
+int thread_create(struct thread *t, void (*start_routine)(), void *arg);
void thread_join(struct thread *t);
int thread_yield(void);
struct thread *thread_current(void);
atomic_int obj;
printf("%s() creating 2 threads\n", __func__);
- thread_create(&t1, &a, &obj);
- thread_create(&t2, &a, &obj);
+ thread_create(&t1, (void (*)())&a, &obj);
+ thread_create(&t2, (void (*)())&a, &obj);
thread_join(&t1);
thread_join(&t2);