Skip to content

gh-84570: Implement Waiting in SendChannel.send() #110565

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

Merged
Merged
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
12 changes: 4 additions & 8 deletions Lib/test/support/interpreters.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,7 @@ def send(self, obj):

This blocks until the object is received.
"""
_channels.send(self._id, obj)
# XXX We are missing a low-level channel_send_wait().
# See bpo-32604 and gh-19829.
# Until that shows up we fake it:
time.sleep(2)
_channels.send(self._id, obj, blocking=True)

def send_nowait(self, obj):
"""Send the object to the channel's receiving end.
Expand All @@ -223,22 +219,22 @@ def send_nowait(self, obj):
# XXX Note that at the moment channel_send() only ever returns
# None. This should be fixed when channel_send_wait() is added.
# See bpo-32604 and gh-19829.
return _channels.send(self._id, obj)
return _channels.send(self._id, obj, blocking=False)

def send_buffer(self, obj):
"""Send the object's buffer to the channel's receiving end.

This blocks until the object is received.
"""
_channels.send_buffer(self._id, obj)
_channels.send_buffer(self._id, obj, blocking=True)

def send_buffer_nowait(self, obj):
"""Send the object's buffer to the channel's receiving end.

If the object is immediately received then return True
(else False). Otherwise this is the same as send().
"""
return _channels.send_buffer(self._id, obj)
return _channels.send_buffer(self._id, obj, blocking=False)

def close(self):
_channels.close(self._id, send=True)
Expand Down
Loading