diff options
author | Benjamin Peterson <benjamin@python.org> | 2008-06-13 02:00:47 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2008-06-13 02:00:47 (GMT) |
commit | b03ca4bc687da31942e3e9e3a923e1c4ebfc4453 (patch) | |
tree | a0f728ac9592bb20e41cee4e19ec9e1126d9868c /Lib/bsddb | |
parent | 2d9a086410546ef86358220eab652e03cd5ae5ab (diff) | |
download | cpython-b03ca4bc687da31942e3e9e3a923e1c4ebfc4453.zip cpython-b03ca4bc687da31942e3e9e3a923e1c4ebfc4453.tar.gz cpython-b03ca4bc687da31942e3e9e3a923e1c4ebfc4453.tar.bz2 |
fix more threading API related bugs
Diffstat (limited to 'Lib/bsddb')
-rw-r--r-- | Lib/bsddb/test/test_associate.py | 2 | ||||
-rw-r--r-- | Lib/bsddb/test/test_join.py | 2 | ||||
-rw-r--r-- | Lib/bsddb/test/test_lock.py | 6 | ||||
-rw-r--r-- | Lib/bsddb/test/test_thread.py | 22 |
4 files changed, 16 insertions, 16 deletions
diff --git a/Lib/bsddb/test/test_associate.py b/Lib/bsddb/test/test_associate.py index b9f250b..2876528 100644 --- a/Lib/bsddb/test/test_associate.py +++ b/Lib/bsddb/test/test_associate.py @@ -9,7 +9,7 @@ import time from pprint import pprint try: - from threading import Thread, currentThread + from threading import Thread, current_thread have_threads = 1 except ImportError: have_threads = 0 diff --git a/Lib/bsddb/test/test_join.py b/Lib/bsddb/test/test_join.py index de674ee..7addf40 100644 --- a/Lib/bsddb/test/test_join.py +++ b/Lib/bsddb/test/test_join.py @@ -8,7 +8,7 @@ import time from pprint import pprint try: - from threading import Thread, currentThread + from threading import Thread, current_thread have_threads = 1 except ImportError: have_threads = 0 diff --git a/Lib/bsddb/test/test_lock.py b/Lib/bsddb/test/test_lock.py index 5baba69..0467d83 100644 --- a/Lib/bsddb/test/test_lock.py +++ b/Lib/bsddb/test/test_lock.py @@ -7,7 +7,7 @@ import tempfile import time try: - from threading import Thread, currentThread + from threading import Thread, current_thread have_threads = 1 except ImportError: have_threads = 0 @@ -117,7 +117,7 @@ class LockingTestCase(unittest.TestCase): deadlock_detection.end=False deadlock_detection.count=0 t=Thread(target=deadlock_detection) - t.setDaemon(True) + t.set_daemon(True) t.start() self.env.set_timeout(100000, db.DB_SET_LOCK_TIMEOUT) anID = self.env.lock_id() @@ -143,7 +143,7 @@ class LockingTestCase(unittest.TestCase): self.assertTrue(deadlock_detection.count>0) def theThread(self, sleepTime, lockType): - name = currentThread().getName() + name = current_thread().get_name() if lockType == db.DB_LOCK_WRITE: lt = "write" else: diff --git a/Lib/bsddb/test/test_thread.py b/Lib/bsddb/test/test_thread.py index e39124e..85d7736 100644 --- a/Lib/bsddb/test/test_thread.py +++ b/Lib/bsddb/test/test_thread.py @@ -12,7 +12,7 @@ from random import random DASH = b'-' try: - from threading import Thread, currentThread + from threading import Thread, current_thread have_threads = True except ImportError: have_threads = False @@ -89,20 +89,20 @@ class BaseThreadedTestCase(unittest.TestCase): self._writerThread(*args, **kwargs) except db.DBLockDeadlockError: if verbose: - print(currentThread().getName(), 'died from', e) + print(current_thread().get_name(), 'died from', e) else: if verbose: - print(currentThread().getName(), "finished.") + print(current_thread().get_name(), "finished.") def readerThread(self, *args, **kwargs): try: self._readerThread(*args, **kwargs) except db.DBLockDeadlockError as e: if verbose: - print(currentThread().getName(), 'died from', e) + print(current_thread().get_name(), 'died from', e) else: if verbose: - print(currentThread().getName(), "finished.") + print(current_thread().get_name(), "finished.") @@ -143,7 +143,7 @@ class ConcurrentDataStoreBase(BaseThreadedTestCase): t.join() def _writerThread(self, d, howMany): - name = currentThread().getName() + name = current_thread().get_name() start = 0 stop = howMany if verbose: @@ -172,7 +172,7 @@ class ConcurrentDataStoreBase(BaseThreadedTestCase): def _readerThread(self, d, readerNum): time.sleep(0.01 * readerNum) - name = currentThread().getName() + name = current_thread().get_name() for loop in range(5): c = d.cursor() @@ -240,7 +240,7 @@ class SimpleThreadedBase(BaseThreadedTestCase): t.join() def _writerThread(self, d, howMany, writerNum): - name = currentThread().getName() + name = current_thread().get_name() start = howMany * writerNum stop = howMany * (writerNum + 1) - 1 if verbose: @@ -286,7 +286,7 @@ class SimpleThreadedBase(BaseThreadedTestCase): def _readerThread(self, d, readerNum): time.sleep(0.01 * readerNum) - name = currentThread().getName() + name = current_thread().get_name() for loop in range(5): c = d.cursor() @@ -385,7 +385,7 @@ class ThreadedTransactionsBase(BaseThreadedTestCase): time.sleep(0.05) def _writerThread(self, d, howMany, writerNum): - name = currentThread().getName() + name = current_thread().get_name() start = howMany * writerNum stop = howMany * (writerNum + 1) - 1 if verbose: @@ -427,7 +427,7 @@ class ThreadedTransactionsBase(BaseThreadedTestCase): def _readerThread(self, d, readerNum): time.sleep(0.01 * readerNum + 0.05) - name = currentThread().getName() + name = current_thread().get_name() for loop in range(5): finished = False |