Currently there are these two lines in sched.h:
extern volatile tcb_t *sched_threads[MAXTHREADS];
extern volatile tcb_t *active_thread;
The first declaration means: "declare sched_threads as array MAXTHREADS of pointer to volatile tcb_t". That is not the thing you want, you want: "declare sched_threads as array MAXTHREADS of volatile pointer to tcb_t".
You need:
extern tcb_t *volatile sched_threads[MAXTHREADS];
extern tcb_t *volatile active_thread;
to make the pointers volatile.
Currently there are these two lines in sched.h:
The first declaration means: "declare sched_threads as array MAXTHREADS of pointer to volatile tcb_t". That is not the thing you want, you want: "declare sched_threads as array MAXTHREADS of volatile pointer to tcb_t".
You need:
to make the pointers volatile.