Threading att 1

This commit is contained in:
2024-04-08 15:20:44 +02:00
parent 9061203aae
commit e93eef28b3
3 changed files with 18 additions and 8 deletions
+4
View File
@@ -8,6 +8,9 @@ ENCODING = "utf-8"
CHUNk = "_chunk.txt"
_sentinel = object()
#TODO: Doisy wchodzą jako lista krotek (doi, False) - po znalezieniu zaznaczamy na True i potem już nie porównujemy
#TODO: lista krotek - jeśli wszystkie mają True dajemy terma
def producer(out_q, control_q, filename):
with open(DATABASE_PATH + filename, "r+", encoding=ENCODING) as operated_file:
lines = operated_file.readlines()
@@ -28,6 +31,7 @@ def producer(out_q, control_q, filename):
#IMPORTANT!!! ONLY ONE CONSUMER THREAD AS WE ARE NOT PUTTING SENTINELS BACK
#TODO: Change doi to tuple list and only put term when all doi are found => (doi, True)
def consumer(in_q, control_q, doi):
sentinels = 0
while True: