标签:多进程 val RoCE div dex ber thread UNC star
from
multiprocessing
import
Process
import
time
def
f(name):
time.sleep(
2
)
print
(
‘hello‘
, name)
if
__name__
=
=
‘__main__‘
:
p
=
Process(target
=
f, args
=
(
‘bob‘
,))
p.start()
p.join()
#!/usr/bin/env python
import multiprocessing
import time,threading
def thread_run():
print(threading.get_ident())
def run(name):
time.sleep(2)
print(‘hello‘,name)
t = threading.Thread(target= thread_run,)
t.start()
if __name__ == ‘__main__‘:
for i in range(10):
p = multiprocessing.Process(target=run,args=(‘bob %s ‘%i,))
p.start()
标签:多进程 val RoCE div dex ber thread UNC star
原文地址:https://www.cnblogs.com/rongye/p/9979544.html