1
이 코드는 장벽을 사용하여 Python3에서 구현했습니다. 나는 Python2.7에서 동일한 기능을하고 싶지만 내가 장벽이 Python2.7Python2.7에서의 배리어 구현
에 거기import threading
import time
from threading import Thread,Barrier
b = Barrier(2, timeout=50)
def func1():
time.sleep(3)
b.wait()
print('Working from func1')
return
def func2():
time.sleep(5)
b.wait()
print('Working from func2')
return
if __name__ == '__main__':
Thread(target = func1).start()
Thread(target = func2).start()