summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_thread.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1998-05-20 17:05:52 (GMT)
committerGuido van Rossum <guido@python.org>1998-05-20 17:05:52 (GMT)
commitb26a1b4e2b99f4473c2133a2206b782a7fa57932 (patch)
treec6fcbbac623adacff0117641975cc75d49f33da5 /Lib/test/test_thread.py
parent33d7f1a76c3544d2901492cfb6fc9db85f2dfbd6 (diff)
downloadcpython-b26a1b4e2b99f4473c2133a2206b782a7fa57932.zip
cpython-b26a1b4e2b99f4473c2133a2206b782a7fa57932.tar.gz
cpython-b26a1b4e2b99f4473c2133a2206b782a7fa57932.tar.bz2
Use random instead of whrandom.
Diffstat (limited to 'Lib/test/test_thread.py')
-rw-r--r--Lib/test/test_thread.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/Lib/test/test_thread.py b/Lib/test/test_thread.py
index 113135b..710fb89 100644
--- a/Lib/test/test_thread.py
+++ b/Lib/test/test_thread.py
@@ -3,12 +3,12 @@
# Create a bunch of threads, let each do some work, wait until all are done
from test_support import verbose
-import whrandom
+import random
import thread
import time
mutex = thread.allocate_lock()
-whmutex = thread.allocate_lock() # for calls to whrandom
+rmutex = thread.allocate_lock() # for calls to random
running = 0
done = thread.allocate_lock()
done.acquire()
@@ -17,9 +17,9 @@ numtasks = 10
def task(ident):
global running
- whmutex.acquire()
- delay = whrandom.random() * numtasks
- whmutex.release()
+ rmutex.acquire()
+ delay = random.random() * numtasks
+ rmutex.release()
if verbose:
print 'task', ident, 'will run for', round(delay, 1), 'sec'
time.sleep(delay)
@@ -85,9 +85,9 @@ def task2(ident):
# of the current one
delay = 0.001
else:
- whmutex.acquire()
- delay = whrandom.random() * numtasks
- whmutex.release()
+ rmutex.acquire()
+ delay = random.random() * numtasks
+ rmutex.release()
if verbose:
print 'task', ident, 'will run for', round(delay, 1), 'sec'
time.sleep(delay)