线程进程
lyc2016012170
这个作者很懒,什么都没留下…
展开
-
Python在程序中进行多任务操作-线程
一个简单的线程 import timeimport threadingdef task1(arg): while True: print("--%s--" % arg) time.sleep(0.1)def task2(arg): while True: print("--%s--" % arg) time.sleep(0.1)def main(): t1 = threading.Thread(target = ...原创 2020-09-11 09:58:09 · 248 阅读 · 1 评论 -
Python在程序中进行多任务操作-进程
进程的创建-multiprocessing multiprocessing模块就是跨平台版本的多进程模块,提供了一个Process类来代表一个进程对象,这个对象可以理解为是一个独立的进程,可以执行另外的事情 # -*- coding:utf-8 -*-from multiprocessing import Processimport timedef run_proc(): """子进程要执行的代码""" while True: print("----2----") .原创 2020-09-11 09:57:16 · 243 阅读 · 0 评论