Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
micropython
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
card10
micropython
Commits
0ef015b2
Commit
0ef015b2
authored
11 years ago
by
Paul Sokolovsky
Browse files
Options
Downloads
Patches
Plain Diff
stream: Make non-blcoking stream support configurable.
Enable only on unix. To avoid unpleasant surprises with error codes.
parent
6c62e725
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
py/mpconfig.h
+5
-0
5 additions, 0 deletions
py/mpconfig.h
py/stream.c
+7
-1
7 additions, 1 deletion
py/stream.c
unix/mpconfigport.h
+1
-0
1 addition, 0 deletions
unix/mpconfigport.h
with
13 additions
and
1 deletion
py/mpconfig.h
+
5
−
0
View file @
0ef015b2
...
@@ -249,6 +249,11 @@ typedef double mp_float_t;
...
@@ -249,6 +249,11 @@ typedef double mp_float_t;
#define MICROPY_PATH_MAX (512)
#define MICROPY_PATH_MAX (512)
#endif
#endif
// Whether POSIX-semantics non-blocking streams are supported
#ifndef MICROPY_STREAMS_NON_BLOCK
#define MICROPY_STREAMS_NON_BLOCK (0)
#endif
// Whether to use computed gotos in the VM, or a switch
// Whether to use computed gotos in the VM, or a switch
// Computed gotos are roughly 10% faster, and increase VM code size by a little
// Computed gotos are roughly 10% faster, and increase VM code size by a little
#ifndef MICROPY_USE_COMPUTED_GOTO
#ifndef MICROPY_USE_COMPUTED_GOTO
...
...
This diff is collapsed.
Click to expand it.
py/stream.c
+
7
−
1
View file @
0ef015b2
...
@@ -25,7 +25,6 @@
...
@@ -25,7 +25,6 @@
*/
*/
#include
<string.h>
#include
<string.h>
#include
<errno.h>
#include
"mpconfig.h"
#include
"mpconfig.h"
#include
"nlr.h"
#include
"nlr.h"
...
@@ -33,6 +32,9 @@
...
@@ -33,6 +32,9 @@
#include
"qstr.h"
#include
"qstr.h"
#include
"obj.h"
#include
"obj.h"
#include
"stream.h"
#include
"stream.h"
#if MICROPY_STREAMS_NON_BLOCK
#include
<errno.h>
#endif
// This file defines generic Python stream read/write methods which
// This file defines generic Python stream read/write methods which
// dispatch to the underlying stream interface of an object.
// dispatch to the underlying stream interface of an object.
...
@@ -42,9 +44,13 @@
...
@@ -42,9 +44,13 @@
STATIC
mp_obj_t
stream_readall
(
mp_obj_t
self_in
);
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,
// TODO: This is POSIX-specific (but then POSIX is the only real thing,
// and anything else just emulates it, right?)
// and anything else just emulates it, right?)
#define is_nonblocking_error(errno) ((errno) == EAGAIN || (errno) == EWOULDBLOCK)
#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
)
{
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
];
struct
_mp_obj_base_t
*
o
=
(
struct
_mp_obj_base_t
*
)
args
[
0
];
...
...
This diff is collapsed.
Click to expand it.
unix/mpconfigport.h
+
1
−
0
View file @
0ef015b2
...
@@ -39,6 +39,7 @@
...
@@ -39,6 +39,7 @@
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_DOUBLE)
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_DOUBLE)
#define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_MPZ)
#define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_MPZ)
#define MICROPY_PATH_MAX (PATH_MAX)
#define MICROPY_PATH_MAX (PATH_MAX)
#define MICROPY_STREAMS_NON_BLOCK (1)
#define MICROPY_USE_COMPUTED_GOTO (1)
#define MICROPY_USE_COMPUTED_GOTO (1)
#define MICROPY_MOD_SYS_STDFILES (1)
#define MICROPY_MOD_SYS_STDFILES (1)
#define MICROPY_ENABLE_MOD_CMATH (1)
#define MICROPY_ENABLE_MOD_CMATH (1)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment