Python multiprocessing.util.ForkAwareThreadLock() Examples
The following are 14
code examples of multiprocessing.util.ForkAwareThreadLock().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
multiprocessing.util
, or try the search function
.
Example #1
Source File: test_multiprocessing.py From ironpython2 with Apache License 2.0 | 5 votes |
def test_flags(self): import json, subprocess # start child process using unusual flags prog = ('from test.test_multiprocessing import TestFlags; ' + 'TestFlags.run_in_child()') data = subprocess.check_output( [sys.executable, '-E', '-B', '-O', '-c', prog]) child_flags, grandchild_flags = json.loads(data.decode('ascii')) self.assertEqual(child_flags, grandchild_flags) # # Issue #17555: ForkAwareThreadLock #
Example #2
Source File: test_multiprocessing.py From ironpython2 with Apache License 2.0 | 5 votes |
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 #
Example #3
Source File: test_multiprocessing.py From BinderFilter with MIT License | 5 votes |
def test_flags(self): import json, subprocess # start child process using unusual flags prog = ('from test.test_multiprocessing import TestFlags; ' + 'TestFlags.run_in_child()') data = subprocess.check_output( [sys.executable, '-E', '-B', '-O', '-c', prog]) child_flags, grandchild_flags = json.loads(data.decode('ascii')) self.assertEqual(child_flags, grandchild_flags) # # Issue #17555: ForkAwareThreadLock #
Example #4
Source File: test_multiprocessing.py From BinderFilter with MIT License | 5 votes |
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) # # #
Example #5
Source File: test_multiprocessing.py From oss-ftp with MIT License | 5 votes |
def test_flags(self): import json, subprocess # start child process using unusual flags prog = ('from test.test_multiprocessing import TestFlags; ' + 'TestFlags.run_in_child()') data = subprocess.check_output( [sys.executable, '-E', '-B', '-O', '-c', prog]) child_flags, grandchild_flags = json.loads(data.decode('ascii')) self.assertEqual(child_flags, grandchild_flags) # # Issue #17555: ForkAwareThreadLock #
Example #6
Source File: test_multiprocessing.py From oss-ftp with MIT License | 5 votes |
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 #
Example #7
Source File: _test_multiprocessing.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def test_noforkbomb(self): sm = multiprocessing.get_start_method() name = os.path.join(os.path.dirname(__file__), 'mp_fork_bomb.py') if sm != 'fork': rc, out, err = test.support.script_helper.assert_python_failure(name, sm) self.assertEqual(out, b'') self.assertIn(b'RuntimeError', err) else: rc, out, err = test.support.script_helper.assert_python_ok(name, sm) self.assertEqual(out.rstrip(), b'123') self.assertEqual(err, b'') # # Issue #17555: ForkAwareThreadLock #
Example #8
Source File: _test_multiprocessing.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
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 #
Example #9
Source File: _test_multiprocessing.py From ironpython3 with Apache License 2.0 | 5 votes |
def test_noforkbomb(self): sm = multiprocessing.get_start_method() name = os.path.join(os.path.dirname(__file__), 'mp_fork_bomb.py') if sm != 'fork': rc, out, err = test.script_helper.assert_python_failure(name, sm) self.assertEqual(out, b'') self.assertIn(b'RuntimeError', err) else: rc, out, err = test.script_helper.assert_python_ok(name, sm) self.assertEqual(out.rstrip(), b'123') self.assertEqual(err, b'') # # Issue #17555: ForkAwareThreadLock #
Example #10
Source File: _test_multiprocessing.py From ironpython3 with Apache License 2.0 | 5 votes |
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 #
Example #11
Source File: test_multiprocessing.py From gcblue with BSD 3-Clause "New" or "Revised" License | 5 votes |
def test_flags(self): import json, subprocess # start child process using unusual flags prog = ('from test.test_multiprocessing import TestFlags; ' + 'TestFlags.run_in_child()') data = subprocess.check_output( [sys.executable, '-E', '-B', '-O', '-c', prog]) child_flags, grandchild_flags = json.loads(data.decode('ascii')) self.assertEqual(child_flags, grandchild_flags) # # Issue #17555: ForkAwareThreadLock #
Example #12
Source File: test_multiprocessing.py From gcblue with BSD 3-Clause "New" or "Revised" License | 5 votes |
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 #
Example #13
Source File: _test_multiprocessing.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 5 votes |
def test_noforkbomb(self): sm = multiprocessing.get_start_method() name = os.path.join(os.path.dirname(__file__), 'mp_fork_bomb.py') if sm != 'fork': rc, out, err = test.support.script_helper.assert_python_failure(name, sm) self.assertEqual(out, b'') self.assertIn(b'RuntimeError', err) else: rc, out, err = test.support.script_helper.assert_python_ok(name, sm) self.assertEqual(out.rstrip(), b'123') self.assertEqual(err, b'') # # Issue #17555: ForkAwareThreadLock #
Example #14
Source File: _test_multiprocessing.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 5 votes |
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 #