➌
while True:
line = shared_memory[i]
if line == -1:
print(f"{current_thread().name}: 데이터 사용 불가\n"
f"1초 대기 후 재시도")
time.sleep(1)
continue
print(f"{current_thread().name}: 데이터 읽기: {int(line)}")
break
def main() -> None:
threads = [
Consumer(),
Producer(),
]
➍
for thread in threads:
thread.start()