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