FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
learn-python3/samples/multitask/multi_processing.py at master · lqstyle/learn-python3 · GitHub
lqstyle
learn-python3
Repository navigation
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
learn-python3
/
samples
/
multitask
/
multi_processing.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
17 lines (14 loc) · 428 Bytes
Breadcrumbs
learn-python3
/
samples
/
multitask
/
multi_processing.py
Copy path
File metadata and controls
executable file
·
17 lines (14 loc) · 428 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from
multiprocessing
import
Process
import
os
# 子进程要执行的代码
def
run_proc
(
name
):
print
(
'Run child process %s (%s)...'
%
(
name
,
os
.
getpid
()))
if
__name__
==
'__main__'
:
print
(
'Parent process %s.'
%
os
.
getpid
())
p
=
Process
(
target
=
run_proc
,
args
=
(
'test'
,))
print
(
'Child process will start.'
)
p
.
start
()
p
.
join
()
print
(
'Child process end.'
)
Back
|
FazBrowse Home
|
New Git URL