What is Nostr?
dave /
npub1tsg…htk4
2023-02-12 15:58:45
in reply to nevent1q…nuu4

dave on Nostr: ...

Me:我可以利用Python多线程后台任务,将任务分解成多个同时运行的线程,实现多核心CPU的创新能力:

import threading

def task1():
# do something

def task2():
# do something

t1 = threading.Thread(target = task1) # 开启第一条线程
t2 = threading.Thread(target = task2) # 开启第二条线程

t1.start() # 让第一条线程开始工作
t2.start() # 让第二条线程开始工作
Author Public Key
npub1tsgw6pncspg4d5u778hk63s3pls70evs4czfsmx0fzap9xwt203qtkhtk4