本文整理汇总了Python中multiprocessing.util._afterfork_registry方法的典型用法代码示例。如果您正苦于以下问题:Python util._afterfork_registry方法的具体用法?Python util._afterfork_registry怎么用?Python util._afterfork_registry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类multiprocessing.util
的用法示例。
在下文中一共展示了util._afterfork_registry方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: child
# 需要导入模块: from multiprocessing import util [as 别名]
# 或者: from multiprocessing.util import _afterfork_registry [as 别名]
def child(cls, n, conn):
if n > 1:
p = multiprocessing.Process(target=cls.child, args=(n-1, conn))
p.start()
p.join()
else:
conn.send(len(util._afterfork_registry))
conn.close()
示例2: test_lock
# 需要导入模块: from multiprocessing import util [as 别名]
# 或者: from multiprocessing.util import _afterfork_registry [as 别名]
def test_lock(self):
r, w = multiprocessing.Pipe(False)
l = util.ForkAwareThreadLock()
old_size = len(util._afterfork_registry)
p = multiprocessing.Process(target=self.child, args=(5, w))
p.start()
new_size = r.recv()
p.join()
self.assertLessEqual(new_size, old_size)
#
# Issue #17097: EINTR should be ignored by recv(), send(), accept() etc
#
示例3: test_lock
# 需要导入模块: from multiprocessing import util [as 别名]
# 或者: from multiprocessing.util import _afterfork_registry [as 别名]
def test_lock(self):
r, w = multiprocessing.Pipe(False)
l = util.ForkAwareThreadLock()
old_size = len(util._afterfork_registry)
p = multiprocessing.Process(target=self.child, args=(5, w))
p.start()
new_size = r.recv()
p.join()
self.assertLessEqual(new_size, old_size)
#
#
#
示例4: child
# 需要导入模块: from multiprocessing import util [as 别名]
# 或者: from multiprocessing.util import _afterfork_registry [as 别名]
def child(cls, n, conn):
if n > 1:
p = multiprocessing.Process(target=cls.child, args=(n-1, conn))
p.start()
conn.close()
p.join(timeout=5)
else:
conn.send(len(util._afterfork_registry))
conn.close()
示例5: test_lock
# 需要导入模块: from multiprocessing import util [as 别名]
# 或者: from multiprocessing.util import _afterfork_registry [as 别名]
def test_lock(self):
r, w = multiprocessing.Pipe(False)
l = util.ForkAwareThreadLock()
old_size = len(util._afterfork_registry)
p = multiprocessing.Process(target=self.child, args=(5, w))
p.start()
w.close()
new_size = r.recv()
p.join(timeout=5)
self.assertLessEqual(new_size, old_size)
#
# Check that non-forked child processes do not inherit unneeded fds/handles
#