Replace access to `sched_active_task` and `sched_active_pid` with calls to `thread_getpid()` and `thread_get_active()`.