Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions src/lib/libpipefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Collaborator

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 pollAsync should probably be wrapped in #if PTHREADS || ASYNCIFY

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 }}}) {
Expand All @@ -109,9 +117,6 @@ addToLibrary({
}
}

#if PTHREADS
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm.. I do you know why this isn't #if PTHREADS || ASYNCIFY like it is in libsyscall.sj.. I'm suprised that the tests still pass despite this.

Copy link
Collaborator

Choose a reason for hiding this comment

The 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) {
Expand Down
4 changes: 2 additions & 2 deletions src/lib/libsyscall.js
Original file line number Diff line number Diff line change
Expand Up @@ -625,8 +625,8 @@ var SyscallsLibrary = {
if (stream) {
if (stream.stream_ops.poll) {
#if PTHREADS || ASYNCIFY
if (isAsyncContext && timeout) {
flags = stream.stream_ops.poll(stream, timeout, makeNotifyCallback(stream, pollfd));
if (stream.stream_ops.pollAsync && isAsyncContext && timeout) {
flags = stream.stream_ops.pollAsync(stream, makeNotifyCallback(stream, pollfd));
} else
#endif
flags = stream.stream_ops.poll(stream, -1);
Expand Down
Loading