Commits

Michael Lee  committed a740486

Switching from Lock to Semaphore

  • Participants
  • Parent commits 8aefba8

Comments (0)

Files changed (1)

File concur/python/prod_cons.py

 from __future__ import print_function
-from threading import Semaphore, Lock, Thread
+from threading import Semaphore, Thread
 from collections import deque
 from random import random
 from time import sleep
     n = int(sys.argv[1])
     spaces = Semaphore(5)
     items  = Semaphore(0)
-    mutex  = Lock()  # equivalent to Semaphore(1)
+    mutex  = Semaphore(1)
     buf    = deque()
     p_t = Thread(target=producer, args=[n])
     p_t.start()