Hai Shi
e80697d687
bpo-40275: Adding threading_helper submodule in test.support (GH-20263)
2020-05-28 00:10:27 +02:00
Victor Stinner
87255be696
bpo-40089: Add _at_fork_reinit() method to locks (GH-19195)
...
Add a private _at_fork_reinit() method to _thread.Lock,
_thread.RLock, threading.RLock and threading.Condition classes:
reinitialize the lock after fork in the child process; reset the lock
to the unlocked state.
Rename also the private _reset_internal_locks() method of
threading.Event to _at_fork_reinit().
* Add _PyThread_at_fork_reinit() private function. It is excluded
from the limited C API.
* threading.Thread._reset_internal_locks() now calls
_at_fork_reinit() on self._tstate_lock rather than creating a new
Python lock object.
2020-04-07 23:11:49 +02:00
Serhiy Storchaka
1f21eaa15e
bpo-15999: Clean up of handling boolean arguments. (GH-15610)
...
* Use the 'p' format unit instead of manually called PyObject_IsTrue().
* Pass boolean value instead 0/1 integers to functions that needs boolean.
* Convert some arguments to boolean only once.
2019-09-01 12:16:51 +03:00
Min ho Kim
39d87b5471
Fix typos mostly in comments, docs and test names (GH-15209)
2019-08-30 16:21:19 -04:00
Raymond Hettinger
35f6301d68
bpo-10978: Semaphores can release multiple threads at a time (GH-15588)
2019-08-29 01:45:19 -07:00
Victor Stinner
2cf4c202ff
bpo-35513: Replace time.time() with time.monotonic() in tests (GH-11182)
...
Replace time.time() with time.monotonic() in tests to measure time
delta.
test_zipfile64: display progress every minute (60 secs) rather than
every 5 minutes (5*60 seconds).
2018-12-17 09:36:36 +01:00
Victor Stinner
81950495ba
bpo-32692: Fix test_threading.test_set_and_clear() (GH-8331)
...
Increase the timeout: give timeout x 4 instead of timeout x 2 to
threads to wait until the Event is set, but reduce the sleep from 500
ms to 250 ms. So the test should be more reliable and faster!
2018-07-19 10:49:58 +02:00
Garrett Berg
a0374dd34a
bpo-32208: update threading.Semaphore docs and add unit test ( #4709 )
...
* fix issue32208: update threading.Semaphore docs and add unit test to validate correct behavior
* add test for blocking
* Update threading.rst
* semaphore: remove documentation validation tests and move 'return value' test to BaseSemaphore
2017-12-07 20:04:26 +02:00
Victor Stinner
ff40ecda73
bpo-31234: Add test.support.wait_threads_exit() ( #3578 )
...
Use _thread.count() to wait until threads exit. The new context
manager prevents the "dangling thread" warning.
2017-09-14 13:07:24 -07:00
Victor Stinner
096ae3373a
bpo-31234: Try to fix lock_tests warning ( #3557 )
...
Try to fix the "Warning -- threading_cleanup() failed to cleanup 1
threads" warning in test.lock_tests: wait a little bit longer to give
time to the threads to complete.
Warning seen on test_thread and test_importlib.
2017-09-13 16:41:08 -07:00
Serhiy Storchaka
32cb968a2e
bpo-30727: Fix a race condition in test_threading. ( #2334 )
2017-06-23 13:36:36 +03:00
Berker Peksag
dd745cc3ff
Issue #25551 : Test condition behavior instead of its internals
...
test_reset_internal_locks was looking at Event's _cond._lock. This
makes it harder to change internals of the Condition object and
makes the test fragile.
The test was added by Nir Soffer in 6108d30dde21.
Patch by Nir Soffer.
2016-04-29 17:25:51 +03:00
Berker Peksag
6d34bbbfc7
Issue #25551 : Test condition behavior instead of its internals
...
test_reset_internal_locks was looking at Event's _cond._lock. This
makes it harder to change internals of the Condition object and
makes the test fragile.
The test was added by Nir Soffer in 6108d30dde21.
Patch by Nir Soffer.
2016-04-29 17:25:29 +03:00
Raymond Hettinger
7836a27ceb
Issue #25298 : Add lock and rlock weakref tests (Contributed by Nir Soffer).
2015-10-09 00:03:51 -04:00
Benjamin Peterson
72181b2f53
merge 3.4 ( #25319 )
2015-10-05 22:00:33 -07:00
Benjamin Peterson
15982aad2b
reinitialize an Event's Condition with a regular lock ( closes #25319 )
2015-10-05 21:56:22 -07:00
Serhiy Storchaka
1770fde94c
Make some tests more frienly to MemoryError.
...
Free memory, unlock hanging threads.
2015-03-28 20:39:51 +02:00
Serhiy Storchaka
9db55004a1
Make some tests more frienly to MemoryError.
...
Free memory, unlock hanging threads.
2015-03-28 20:38:37 +02:00
Raymond Hettinger
62f4dad816
Issue 21137: Better repr for threading.Lock()
2014-05-25 18:22:35 -07:00
Kristjan Valur Jonsson
020af2a2bc
Issue #8799 : Reduce timing sensitivity of condition test by explicitly
...
delaying the main thread so that it doesn't race ahead of the workers.
2013-11-11 11:29:04 +00:00
Christian Heimes
c5d95b17ac
Add simple test for repr(lock)
2013-07-30 15:54:39 +02:00
Antoine Pitrou
ea3eb88bca
Issue #9260 : A finer-grained import lock.
...
Most of the import sequence now uses per-module locks rather than the
global import lock, eliminating well-known issues with threads and imports.
2012-05-17 18:55:59 +02:00
Charles-François Natali
61d28d6a74
Issue #13502 : threading: Fix a race condition in Event.wait() that made it
...
return False when the event was set and cleared right after.
2012-01-07 18:26:39 +01:00
Charles-François Natali
ded0348c08
Issue #13502 : threading: Fix a race condition in Event.wait() that made it
...
return False when the event was set and cleared right after.
2012-01-07 18:24:56 +01:00
Charles-François Natali
fd96eb2a68
Issue #11871 : In test_threading.BarrierTests, bump the default barrier timeout
...
to avoid timing-dependent failures.
2011-07-27 21:28:23 +02:00
Charles-François Natali
d4d1d068dc
Issue #11871 : In test_threading.BarrierTests, bump the default barrier timeout
...
to avoid timing-dependent failures.
2011-07-27 21:26:42 +02:00
Victor Stinner
2a12974bca
Close #12028 : Make threading._get_ident() public, rename it to
...
threading.get_ident() and document it. This function was used by
_thread.get_ident().
2011-05-30 23:02:52 +02:00
Victor Stinner
5f3b1c4979
(Merge 3.2) Issue #12096 : Fix a race condition in
...
test_threading.test_waitfor(). Patch written by Charles-François Natali.
2011-05-18 00:20:18 +02:00
Victor Stinner
3349bca46d
Issue #12096 : Fix a race condition in test_threading.test_waitfor(). Patch
...
written by Charles-François Natali.
2011-05-18 00:16:14 +02:00
Victor Stinner
c2824d41c3
Issue #11915 : threading.RLock()._release_save() raises a RuntimeError if the
...
lock was not acquired.
2011-04-24 23:41:33 +02:00
Antoine Pitrou
4333affb74
Try to fix sporadic failure in test_thread/test_threading
2011-04-04 22:00:10 +02:00
Antoine Pitrou
45fdb457da
Try to fix sporadic failure in test_thread/test_threading
2011-04-04 21:59:09 +02:00
Antoine Pitrou
7899acfc23
Issue #11618 : Fix the timeout logic in threading.Lock.acquire() under
...
Windows.
2011-03-31 01:00:32 +02:00
Kristján Valur Jónsson
6331520950
Issue 10260
...
Adding the wait_for() method to threading.Condition
2010-11-18 12:46:39 +00:00
Antoine Pitrou
12ae290bf3
Use laxer timeouts in barrier tests
2010-11-17 21:55:41 +00:00
Kristján Valur Jónsson
f53a626073
issue 10237
...
After increasing the default timeout for the barrier, the unittest for the default timeout must be adjusted
2010-10-31 03:00:57 +00:00
Kristján Valur Jónsson
6b6dffdc73
issue 10237
...
Increase the default timout of the barries used in the barrier tests. This should solve unexpected timeouts on some machines.
2010-10-30 05:15:42 +00:00
Kristján Valur Jónsson
3be00037d6
issue 8777
...
Add threading.Barrier
2010-10-28 09:43:10 +00:00
Georg Brandl
b9a4391754
#10218 : return timeout status from Condition.wait, mirroring other primitives' behavior.
2010-10-28 09:03:20 +00:00
Antoine Pitrou
0454af9b54
Issue #850728 : Add a *timeout* parameter to the `acquire()` method of
...
`threading.Semaphore` objects. Original patch by Torsten Landschoff.
2010-04-17 23:51:58 +00:00
Antoine Pitrou
7c3e577395
Issue #7316 : the acquire() method of lock objects in the :mod:`threading`
...
module now takes an optional timeout argument in seconds. Timeout support
relies on the system threading library, so as to avoid a semi-busy wait
loop.
2010-04-14 15:44:10 +00:00
Antoine Pitrou
959f3e5032
Merged revisions 76138,76173 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/branches/py3k
................
r76138 | antoine.pitrou | 2009-11-06 23:41:14 +0100 (ven., 06 nov. 2009) | 10 lines
Merged revisions 76137 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r76137 | antoine.pitrou | 2009-11-06 23:34:35 +0100 (ven., 06 nov. 2009) | 4 lines
Issue #7270 : Add some dedicated unit tests for multi-thread synchronization
primitives such as Lock, RLock, Condition, Event and Semaphore.
........
................
r76173 | antoine.pitrou | 2009-11-09 17:08:16 +0100 (lun., 09 nov. 2009) | 11 lines
Merged revisions 76172 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r76172 | antoine.pitrou | 2009-11-09 17:00:11 +0100 (lun., 09 nov. 2009) | 5 lines
Issue #7282 : Fix a memory leak when an RLock was used in a thread other
than those started through `threading.Thread` (for example, using
`thread.start_new_thread()`.
........
................
2009-11-09 16:52:46 +00:00
Antoine Pitrou
b087268217
Merged revisions 76172 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/trunk
........
r76172 | antoine.pitrou | 2009-11-09 17:00:11 +0100 (lun., 09 nov. 2009) | 5 lines
Issue #7282 : Fix a memory leak when an RLock was used in a thread other
than those started through `threading.Thread` (for example, using
`thread.start_new_thread()`.
........
2009-11-09 16:08:16 +00:00
Antoine Pitrou
557934f5a9
Merged revisions 76137 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/trunk
........
r76137 | antoine.pitrou | 2009-11-06 23:34:35 +0100 (ven., 06 nov. 2009) | 4 lines
Issue #7270 : Add some dedicated unit tests for multi-thread synchronization
primitives such as Lock, RLock, Condition, Event and Semaphore.
........
2009-11-06 22:41:14 +00:00