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

Method _send_bytes

Lib/multiprocessing/connection.py:291–315  ·  view source on GitHub ↗
(self, buf)

Source from the content-addressed store, hash-verified

289 _CloseHandle(self._handle)
290
291 def _send_bytes(self, buf):
292 if self._send_ov is not None:
293 # A connection should only be used by a single thread
294 raise ValueError("concurrent send_bytes() calls "
295 "are not supported")
296 ov, err = _winapi.WriteFile(self._handle, buf, overlapped=True)
297 self._send_ov = ov
298 try:
299 if err == _winapi.ERROR_IO_PENDING:
300 waitres = _winapi.WaitForMultipleObjects(
301 [ov.event], False, INFINITE)
302 assert waitres == WAIT_OBJECT_0
303 except:
304 ov.cancel()
305 raise
306 finally:
307 self._send_ov = None
308 nwritten, err = ov.GetOverlappedResult(True)
309 if err == _winapi.ERROR_OPERATION_ABORTED:
310 # close() was called by another thread while
311 # WaitForMultipleObjects() was waiting for the overlapped
312 # operation.
313 raise OSError(errno.EPIPE, "handle is closed")
314 assert err == 0
315 assert nwritten == len(buf)
316
317 def _recv_bytes(self, maxsize=None):
318 if self._got_empty_message:

Callers

nothing calls this directly

Calls 1

cancelMethod · 0.45

Tested by

no test coverage detected