def _winapi_childhandle_after_createprocess_child(self):
"""Called on Windows in the child process after the CreateProcess()
system call. This is required for making the handle usable in the child.
"""
if WINAPI_HANDLE_TRANSFER_STEAL:
# In this case the handle has not been inherited by the child
# process during CreateProcess(). Steal it from the parent.
new_winapihandle = multiprocessing.reduction.steal_handle(
self._parent_pid, self._parent_winapihandle)
del self._parent_winapihandle
del self._parent_pid
# Restore C file descriptor with (read/write)only flag.
self._fd = msvcrt.open_osfhandle(new_winapihandle, self._fd_flag)
return
# In this case the handle has been inherited by the child process during
# the CreateProcess() system call. Get C file descriptor from Windows
# file handle.
self._fd = msvcrt.open_osfhandle(
self._inheritable_winapihandle, self._fd_flag)
del self._inheritable_winapihandle
评论列表
文章目录