using sched_lock() to prevent context switching while reading distance data