-
Notifications
You must be signed in to change notification settings - Fork 19
/
answer.py
30 lines (22 loc) · 972 Bytes
/
answer.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env python3
#-------------------------------------------------------------------------------
from threading import Barrier
class Foo:
def __init__(self):
self.first_barrier = Barrier(2)
self.second_barrier = Barrier(2)
pass
def first(self, printFirst: 'Callable[[], None]') -> None:
# printFirst() outputs "first". Do not change or remove this line.
printFirst()
self.first_barrier.wait()
def second(self, printSecond: 'Callable[[], None]') -> None:
self.first_barrier.wait()
# printSecond() outputs "second". Do not change or remove this line.
printSecond()
self.second_barrier.wait()
def third(self, printThird: 'Callable[[], None]') -> None:
self.second_barrier.wait()
# printThird() outputs "third". Do not change or remove this line.
printThird()
#-------------------------------------------------------------------------------