Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import threading, time
- threadLimiter = threading.Semaphore(5)
- class EncodeThread(threading.Thread):
- def __init__(self, count):
- self.count = count
- threading.Thread.__init__(self)
- def run(self):
- threadLimiter.acquire()
- try:
- print(self.count)
- time.sleep(10)
- finally:
- threadLimiter.release()
- for i in range(100):
- EncodeThread(i).start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement