diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2015-12-02 00:37:14 +0200 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2015-12-02 00:37:25 +0200 |
commit | 3376875bc8bc7d6854823dcb2c4b763d7c582a99 (patch) | |
tree | b42e79ee6aac57fa7a8751cb069dd5d06103c9f9 /unix/modtime.c | |
parent | 0d9b450701d064efcf57b86c1b7fbe3931179959 (diff) |
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.
Diffstat (limited to 'unix/modtime.c')
-rw-r--r-- | unix/modtime.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/unix/modtime.c b/unix/modtime.c index 0c3324947..2a907a773 100644 --- a/unix/modtime.c +++ b/unix/modtime.c @@ -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; |