Administrator
2023-08-30 87a68117b9957219f17dc7830cb2b33b88a9d1d8
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
import multiprocessing
import threading
import time
 
from huaxin_client import l2_data_manager
from log_module import async_log_util
from log_module.log import logger_debug
 
 
def read(pipe):
    while True:
        val = pipe.recv()
        if val:
            print("read:", val)
 
 
def write(pipe):
    while True:
        pipe.send("test")
        time.sleep(1)
 
 
if __name__ == "__main__":
    p1, p2 = multiprocessing.Pipe()
    threading.Thread(target=lambda: write(p1), daemon=True).start()
    threading.Thread(target=lambda: read(p2), daemon=True).start()
    input()