From daff47ba0d0efdd891d3077164e7f6b79530a195 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B2=88=E7=91=97=E6=9D=B0?= <3695888@qq.com> Date: Mon, 11 Jan 2021 23:21:48 +0800 Subject: [PATCH] Update test_mutiproser.py --- test_mutiproser.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/test_mutiproser.py b/test_mutiproser.py index 8cb827c..218b5b2 100644 --- a/test_mutiproser.py +++ b/test_mutiproser.py @@ -1,7 +1,10 @@ import multiprocessing as mp from multiprocessing.context import Process -import os, time, random +import os +import time +import random + class Main(mp.Process): def __init__(self, dev) -> None: @@ -13,7 +16,7 @@ class Main(mp.Process): def run(self): while self.ttt: print(os.getpid()) - time.sleep(3) + time.sleep(1) while not(self.dev.using): self.dev.using = True print("开始调用a") @@ -36,13 +39,14 @@ class Main(mp.Process): class render(mp.Process): def __init__(self, dev) -> None: Process.__init__(self) + self.bbb = 3 self.ggg = True self.dev = dev - + def run(self): while self.ggg: print(os.getpid()) - time.sleep(3) + time.sleep(1) while not(self.dev.using): self.dev.using = True if random.choice(range(0, 5, 1)) == 4: @@ -78,4 +82,10 @@ if __name__ == "__main__": print(":aaa") A.start() B.start() - time.sleep(5) + time.sleep(3) + print("gogogogogogoogogogogo") + dev.a = False + print("A is deadddddddddddddddddddd AAAAAAAA") + time.sleep(3) + dev.b = False + print("BBBBBBBBBBBBBB")