本文整理汇总了Python中multiprocessing.forking.Popen.duplicate_for_child方法的典型用法代码示例。如果您正苦于以下问题:Python Popen.duplicate_for_child方法的具体用法?Python Popen.duplicate_for_child怎么用?Python Popen.duplicate_for_child使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类multiprocessing.forking.Popen
的用法示例。
在下文中一共展示了Popen.duplicate_for_child方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __getstate__
# 需要导入模块: from multiprocessing.forking import Popen [as 别名]
# 或者: from multiprocessing.forking.Popen import duplicate_for_child [as 别名]
def __getstate__(self):
assert_spawning(self)
r = self._reader._semlock
w = self._writer._semlock
reader = Popen.duplicate_for_child(r.handle), r.kind, r.maxvalue
writer = Popen.duplicate_for_child(w.handle), w.kind, w.maxvalue
return (reader, writer)
示例2: reduce_handle
# 需要导入模块: from multiprocessing.forking import Popen [as 别名]
# 或者: from multiprocessing.forking.Popen import duplicate_for_child [as 别名]
def reduce_handle(handle):
if Popen.thread_is_spawning():
return (None, Popen.duplicate_for_child(handle), True)
dup_handle = duplicate(handle)
_cache.add(dup_handle)
sub_debug('reducing handle %d', handle)
return (_get_listener().address, dup_handle, False)
示例3: __getstate__
# 需要导入模块: from multiprocessing.forking import Popen [as 别名]
# 或者: from multiprocessing.forking.Popen import duplicate_for_child [as 别名]
def __getstate__(self):
assert_spawning(self)
sl = self._semlock
return (Popen.duplicate_for_child(sl.handle), sl.kind, sl.maxvalue)