summaryrefslogtreecommitdiffstats
path: root/Demo/tkinter
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1998-06-30 17:01:06 (GMT)
committerGuido van Rossum <guido@python.org>1998-06-30 17:01:06 (GMT)
commit7e0e9555b73feb664e5fa92f593fcb61b7135e45 (patch)
tree478e6b49360ab19c500a076843f45240ff7181b6 /Demo/tkinter
parent0dd010a9e4a2904997fb2f65947cc347c1f25e0d (diff)
downloadcpython-7e0e9555b73feb664e5fa92f593fcb61b7135e45.zip
cpython-7e0e9555b73feb664e5fa92f593fcb61b7135e45.tar.gz
cpython-7e0e9555b73feb664e5fa92f593fcb61b7135e45.tar.bz2
Get rid of the lock; it's no longer needed.
Diffstat (limited to 'Demo/tkinter')
-rw-r--r--Demo/tkinter/guido/brownian.py20
1 files changed, 5 insertions, 15 deletions
diff --git a/Demo/tkinter/guido/brownian.py b/Demo/tkinter/guido/brownian.py
index b08a956..8007f14 100644
--- a/Demo/tkinter/guido/brownian.py
+++ b/Demo/tkinter/guido/brownian.py
@@ -16,25 +16,15 @@ FILL = 'red'
stop = 0 # Set when main loop exits
-lock = threading.Lock() # Protects the random generator
-
def particle(canvas):
r = RADIUS
- lock.acquire()
- try:
- x = random.gauss(WIDTH/2.0, SIGMA)
- y = random.gauss(HEIGHT/2.0, SIGMA)
- finally:
- lock.release()
+ x = random.gauss(WIDTH/2.0, SIGMA)
+ y = random.gauss(HEIGHT/2.0, SIGMA)
p = canvas.create_oval(x-r, y-r, x+r, y+r, fill=FILL)
while not stop:
- lock.acquire()
- try:
- dx = random.gauss(0, BUZZ)
- dy = random.gauss(0, BUZZ)
- dt = random.expovariate(LAMBDA)
- finally:
- lock.release()
+ dx = random.gauss(0, BUZZ)
+ dy = random.gauss(0, BUZZ)
+ dt = random.expovariate(LAMBDA)
try:
canvas.move(p, dx, dy)
except TclError: