diff options
Diffstat (limited to 'py/stream.h')
-rw-r--r-- | py/stream.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/py/stream.h b/py/stream.h index f9ba3387a9..5eace916fe 100644 --- a/py/stream.h +++ b/py/stream.h @@ -42,4 +42,12 @@ mp_obj_t mp_stream_unbuffered_iter(mp_obj_t self); mp_obj_t mp_stream_write(mp_obj_t self_in, const void *buf, mp_uint_t len); +#if MICROPY_STREAMS_NON_BLOCK +// TODO: This is POSIX-specific (but then POSIX is the only real thing, +// and anything else just emulates it, right?) +#define mp_is_nonblocking_error(errno) ((errno) == EAGAIN || (errno) == EWOULDBLOCK) +#else +#define mp_is_nonblocking_error(errno) (0) +#endif + #endif // __MICROPY_INCLUDED_PY_STREAM_H__ |