-
Notifications
You must be signed in to change notification settings - Fork 2
/
c.py
57 lines (45 loc) · 1.1 KB
/
c.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import rpyc
from rpyc import Service
from threading import Timer
import threading
_global_flag = False
_global_v_flag = False
def change_flag():
global _global_flag
_global_flag = True
def change_v_flag():
global _global_v_flag
_global_v_flag = True
class C(Service):
def exposed_set_flag(self):
change_flag()
def exposed_set_v_flag(self):
print('123')
change_v_flag()
def run(conn):
global _global_flag
global _global_v_flag
conn.root.push(True)
# t = threading.Thread(target=bg, args=(conn,))
# t.start()
while True:
if _global_v_flag:
conn.root.set_flag()
if _global_flag:
print(_global_flag)
break
print(1)
def bg(conn):
global _global_flag
global _global_v_flag
while not _global_flag:
if _global_v_flag:
conn.root.set_flag()
if __name__ == "__main__":
conn = rpyc.connect(
host='111.186.116.71',
port=12346,
keepalive=True,
service=C()
)
run(conn)