Add crt_msleep() and lock support