我正在实施哲学家用餐问题,但是我收到一个错误
# Pick up the forks
forks[self.left_fork].acquire()
locked = forks[self.right_fork].acquire(False)
if locked == True:
break
forks[self.left_fork].release()
forks[self.left_fork], forks[self.right_fork] = forks[self.right_fo\
rk], forks[self.left_fork]
# Put down the forks
forks[self.right_fork].release()
forks[self.left_fork].release()
它打印出
1 is eating
2 is eating
3 is eating
然后给出该错误