请帮助我解决以下死锁情况,同时使用两个线程来打印1至10个数字。
请告诉我避免在多线程python中出现死锁情况的最佳实践。
from threading import *
c = Condition()
def thread_1():
c.acquire()
for i in range(1,11,2):
print(i)
c.notify()
c.wait()
c.release()
c.notify()
def thread_2():
c.acquire()
c.wait()
for i in range(2,2):
print(i)
c.notify()
c.wait()
c.release()
t1 = Thread(target=thread_1)
t2 = Thread(target=thread_2)
t1.start()
t2.start()