diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-05-07 02:23:46 +0300 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-05-07 02:25:45 +0300 |
commit | 0ef015b2533f7faeede18382c1d1f4eac919244b (patch) | |
tree | aac00b410837ccdd3d1b59284cdac5b423767c8e /py/stream.c | |
parent | 6c62e7257f8dec7f20a1ace42f0ae5fa4320ad06 (diff) | |
download | micropython-0ef015b2533f7faeede18382c1d1f4eac919244b.tar.gz micropython-0ef015b2533f7faeede18382c1d1f4eac919244b.zip |
stream: Make non-blcoking stream support configurable.
Enable only on unix. To avoid unpleasant surprises with error codes.
Diffstat (limited to 'py/stream.c')
-rw-r--r-- | py/stream.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/py/stream.c b/py/stream.c index 96bf94fcd9..9eb438b538 100644 --- a/py/stream.c +++ b/py/stream.c @@ -25,7 +25,6 @@ */ #include <string.h> -#include <errno.h> #include "mpconfig.h" #include "nlr.h" @@ -33,6 +32,9 @@ #include "qstr.h" #include "obj.h" #include "stream.h" +#if MICROPY_STREAMS_NON_BLOCK +#include <errno.h> +#endif // This file defines generic Python stream read/write methods which // dispatch to the underlying stream interface of an object. @@ -42,9 +44,13 @@ STATIC mp_obj_t stream_readall(mp_obj_t self_in); +#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 is_nonblocking_error(errno) ((errno) == EAGAIN || (errno) == EWOULDBLOCK) +#else +#define is_nonblocking_error(errno) (0) +#endif STATIC mp_obj_t stream_read(uint n_args, const mp_obj_t *args) { struct _mp_obj_base_t *o = (struct _mp_obj_base_t *)args[0]; |