https://www.cnblogs.com/lovefisho/p/16202006.html

https://docs.python.org/3/library/multiprocessing.html?highlight=queue#module-multiprocessing

参考文档:https://www.cnblogs.com/yan-test/p/16774831.html  

线程有两种方法,一种是直接通过Thread方法构建一个线程,另一种时通过继承Thread类,重写run()方法构建

自定义线程类

  重写init方法和run方法

  init:里面是属性,实例化对象的时候,要把这部分内容传递进去

  

 

 

  run: 就是线程中,要执行的函数,就把他看作是一个普通函数即可

  

 

 

主进程和子进程

  主进程:main下面的

  子进程:类定义

 

进程间通信:

  queue

      put(obj[, block[, timeout]]):将obj放入队列
      get([block[, timeout]]):从队列中取出并返回对象
posted on 2023-03-21 00:41  黑逍逍  阅读(20)  评论(0)    收藏  举报