The task is to organize a state variable in which one trad writes, another reads. Lord Sishniki immediately indicated the need for a lock when writing, reading in a state variable. Did not believe. I try:
import thread status = '' def first(): global status mes = ['0000000000','1111111111'] while 1: status = mes[0] status = mes[1] def second(): mes = ['0000000000','1111111111'] while 1: if status not in mes: print('Ahtung!!!!!') thread.start_new_thread(first,()) thread.start_new_thread(second,()) Still runs without conflict. Who is right? Does python or the thread module destroy this situation? PS Naturally, I imagine that such flows and that such a problem should exist ...