Use pendsv exception to interrupt running code