-
Notifications
You must be signed in to change notification settings - Fork 3.5k
poll: Add pollAsync API to the stream backend #26196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -97,7 +97,15 @@ addToLibrary({ | |
| blocks: 0, | ||
| }; | ||
| }, | ||
| poll(stream, timeout, notifyCallback) { | ||
| pollAsync(stream, notifyCallback) { | ||
| var res = this.poll(stream, 0); | ||
| if (res != 0) return res; | ||
| #if PTHREADS | ||
| stream.node.pipe.registerReadableHandler(notifyCallback); | ||
| #endif | ||
| return 0; | ||
| }, | ||
| poll(stream, timeout) { | ||
| var pipe = stream.node.pipe; | ||
|
|
||
| if ((stream.flags & {{{ cDefs.O_ACCMODE }}}) === {{{ cDefs.O_WRONLY }}}) { | ||
|
|
@@ -109,9 +117,6 @@ addToLibrary({ | |
| } | ||
| } | ||
|
|
||
| #if PTHREADS | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm.. I do you know why this isn't
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah.. that was a real bug: #26206 |
||
| if (notifyCallback) pipe.registerReadableHandler(notifyCallback); | ||
| #endif | ||
| return 0; | ||
| }, | ||
| dup(stream) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the whole of
pollAsyncshould probably be wrapped in#if PTHREADS || ASYNCIFY