Extract out the the scheduler pointer from the environment to
allow scheduling tasks via the common thread pool.