mirror of
https://github.com/dbarzin/pandora-box.git
synced 2025-07-18 21:09:41 +02:00
add threading
This commit is contained in:
parent
f1b9342f98
commit
c265840ca2
2 changed files with 755 additions and 642 deletions
864
pandora-box.py
864
pandora-box.py
File diff suppressed because it is too large
Load diff
|
@ -15,17 +15,16 @@ class myThread (threading.Thread):
|
|||
|
||||
def run(self):
|
||||
print(f"Thread-{self.id} Starting ")
|
||||
process_data(self.id, self.q)
|
||||
self.process_data()
|
||||
print(f"Thread-{self.id} Done.")
|
||||
|
||||
|
||||
def process_data(id, q):
|
||||
def process_data(self):
|
||||
while not exitFlag:
|
||||
queueLock.acquire()
|
||||
if not workQueue.empty():
|
||||
data = q.get()
|
||||
data = self.q.get()
|
||||
queueLock.release()
|
||||
print(f"Thread-{id} processing {data}")
|
||||
print(f"Thread-{self.id} processing {data}")
|
||||
else:
|
||||
queueLock.release()
|
||||
time.sleep(1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue