本文整理匯總了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)