summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2015-12-02 00:37:14 +0200
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2015-12-02 00:37:25 +0200
commit3376875bc8bc7d6854823dcb2c4b763d7c582a99 (patch)
treeb42e79ee6aac57fa7a8751cb069dd5d06103c9f9
parent0d9b450701d064efcf57b86c1b7fbe3931179959 (diff)
downloadmicropython-3376875bc8bc7d6854823dcb2c4b763d7c582a99.tar.gz
micropython-3376875bc8bc7d6854823dcb2c4b763d7c582a99.zip
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.
-rw-r--r--unix/modtime.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/unix/modtime.c b/unix/modtime.c
index 0c33249475..2a907a7736 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;