unix/modtime: sleep(): Return early if KeyboardInterrupt is pending

As set by signal handler. This assumes that exception will be raised
somewhere else, which so far doesn't happen for single function call.
Still, it makes sense to handle that in some common place.
This commit is contained in:
Paul Sokolovsky 2015-12-02 00:37:14 +02:00
parent 0d9b450701
commit 3376875bc8

View File

@ -125,6 +125,9 @@ STATIC mp_obj_t mod_time_sleep(mp_obj_t arg) {
if (res != -1 || errno != EINTR) {
break;
}
if (MP_STATE_VM(mp_pending_exception) != MP_OBJ_NULL) {
return mp_const_none;
}
//printf("select: EINTR: %ld:%ld\n", tv.tv_sec, tv.tv_usec);
#else
break;