diff options
author | Guido van Rossum <guido@python.org> | 1998-08-12 02:38:11 +0000 |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1998-08-12 02:38:11 +0000 |
commit | e03c05059534b4783c5631517cb16f79531358e8 (patch) | |
tree | 82285bf56d90ac5c062f328516a959dd416b8e45 /Lib/dos-8x3/test_thr.py | |
parent | 887d072cc04be23e6758257b326499bd1572b929 (diff) | |
download | cpython-git-e03c05059534b4783c5631517cb16f79531358e8.tar.gz |
The usual.
Diffstat (limited to 'Lib/dos-8x3/test_thr.py')
-rwxr-xr-x | Lib/dos-8x3/test_thr.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Lib/dos-8x3/test_thr.py b/Lib/dos-8x3/test_thr.py index 113135bef9..710fb89430 100755 --- a/Lib/dos-8x3/test_thr.py +++ b/Lib/dos-8x3/test_thr.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) |