daily pastebin goal
31%
SHARE
TWEET

PRVI

markic99 Jun 14th, 2018 (edited) 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import threading
  2.  
  3.  
  4. produkt = 1
  5. lock = threading.Lock()
  6.  
  7.  
  8.  
  9. def mnozenje(x,y):
  10.  
  11.     global produkt
  12.  
  13.     lock.acquire()
  14.  
  15.     for i in range(x,y):
  16.  
  17.         produkt*=i
  18.  
  19.     lock.release()
  20.  
  21. t1=threading.Thread(target=mnozenje, args=(1,750))
  22.  
  23. t2=threading.Thread(target=mnozenje, args=(751,1500))
  24.  
  25.  
  26. t1.start()
  27.  
  28. t2.start()
  29.  
  30.  
  31. t1.join()
  32.  
  33. t2.join()
  34.  
  35.  
  36. print (produkt)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top