MCPcopy Index your code
hub / github.com/python/cpython / build_send_waiter

Method build_send_waiter

Lib/test/test__interpchannels.py:834–855  ·  view source on GitHub ↗
(self, obj, *, buffer=False)

Source from the content-addressed store, hash-verified

832 # send with waiting
833
834 def build_send_waiter(self, obj, *, buffer=False):
835 # We want a long enough sleep that send() actually has to wait.
836
837 if buffer:
838 send = _channels.send_buffer
839 else:
840 send = _channels.send
841
842 cid = _channels.create(REPLACE)
843 try:
844 started = time.monotonic()
845 send(cid, obj, blocking=False)
846 stopped = time.monotonic()
847 recv_nowait(cid)
848 finally:
849 _channels.destroy(cid)
850 delay = stopped - started # seconds
851 delay *= 3
852
853 def wait():
854 time.sleep(delay)
855 return wait
856
857 def test_send_blocking_waiting(self):
858 received = None

Calls 3

recv_nowaitFunction · 0.85
createMethod · 0.45
destroyMethod · 0.45

Tested by

no test coverage detected