some test about mutiprocessing
This commit is contained in:
parent
ccf5099ba1
commit
3626d448ec
@ -3,7 +3,7 @@ writen by shenjackyuanjie
|
||||
mail: 3695888@qq.com
|
||||
"""
|
||||
|
||||
from libs import Game_threads
|
||||
from libs.Game_threads import orbit_demo
|
||||
import libs
|
||||
import pyglet
|
||||
import threading
|
||||
|
@ -7,9 +7,7 @@ import libs
|
||||
import pyglet
|
||||
import threading
|
||||
|
||||
from threading import Thread
|
||||
|
||||
from pyglet.app import run
|
||||
import pyglet.app
|
||||
from pyglet.window import Window
|
||||
from pyglet.resource import image
|
||||
|
||||
@ -31,7 +29,7 @@ class RenderThread(threading.Thread, pyglet.window.Window):
|
||||
# list
|
||||
|
||||
def start_game(self):
|
||||
run()
|
||||
pyglet.app.run()
|
||||
return
|
||||
|
||||
def setup(self):
|
||||
|
2
test.py
2
test.py
@ -32,4 +32,4 @@ f = libs.P_C.S_N_M(A,libs.P_C.S_N_M(B,libs.P_C.S_N_M(C, D)))
|
||||
print("A * B * C * D = " , e)
|
||||
print("A * B * C * D = " , f)
|
||||
|
||||
G = libs.render
|
||||
G = libs.render_thread
|
41
test_mutiproser.py
Normal file
41
test_mutiproser.py
Normal file
@ -0,0 +1,41 @@
|
||||
|
||||
import multiprocessing as mp
|
||||
import os, time
|
||||
|
||||
class Main():
|
||||
def __init__(self, dev) -> None:
|
||||
self.aaa = 1
|
||||
self.ttt = False
|
||||
self.dev = dev
|
||||
|
||||
def main(self):
|
||||
while self.ttt:
|
||||
print(time.time())
|
||||
print(os.getpid())
|
||||
time.sleep(0.5)
|
||||
while not(self.dev.using):
|
||||
self.dev.using = True
|
||||
if self.dev.bget == True:
|
||||
print("B 没拿到")
|
||||
else:
|
||||
print("B 拿到了")
|
||||
self.dev.aget = True
|
||||
self.dev.using = False
|
||||
|
||||
|
||||
class render():
|
||||
def __init__(self, dev) -> None:
|
||||
self.bbb = 3
|
||||
self.ggg = True
|
||||
|
||||
|
||||
class Delivery():
|
||||
def __init__(self) -> None:
|
||||
self.using = False
|
||||
self.dev1 = ""
|
||||
self.aget = False
|
||||
self.bget = False
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
dev = Delivery()
|
Loading…
Reference in New Issue
Block a user