Skip to content

Commit dfb030e

Browse files
Update 1114.py
1 parent 30238a2 commit dfb030e

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

1001-1500/1114.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,31 @@ def third(self, printThird: 'Callable[[], None]') -> None:
2424
continue
2525
# printThird() outputs "third". Do not change or remove this line.
2626
printThird()
27+
28+
29+
30+
from threading import Barrier
31+
32+
class Foo:
33+
def __init__(self):
34+
self.first_barrier = Barrier(2)
35+
self.second_barrier = Barrier(2)
36+
37+
38+
def first(self, printFirst: 'Callable[[], None]') -> None:
39+
# printFirst() outputs "first". Do not change or remove this line.
40+
printFirst()
41+
self.first_barrier.wait()
42+
43+
44+
def second(self, printSecond: 'Callable[[], None]') -> None:
45+
self.first_barrier.wait()
46+
# printSecond() outputs "second". Do not change or remove this line.
47+
printSecond()
48+
self.second_barrier.wait()
49+
50+
51+
def third(self, printThird: 'Callable[[], None]') -> None:
52+
self.second_barrier.wait()
53+
# printThird() outputs "third". Do not change or remove this line.
54+
printThird()

0 commit comments

Comments
 (0)