当前位置:网站首页>Differences between pycharm and idle and process -- join() in vs Code
Differences between pycharm and idle and process -- join() in vs Code
2022-07-05 07:29:00 【work-harder】
background :
win8.1, idle - python 3.9.7 Bring their own , pycharm2021.3.1
vs code 1.64.2 [ to update ]
The phenomenon :
process Of join(timeout), stay idle and pycharm neutralize ?
No matter what timeout The numerical ratio of sub process (sleep) The waiting time is obviously long or short , Can't see the result . And in the demo pycharm2017.2.7 in , be ( Output ) The results are different .
[ to update ]
terms of settlement :
vs code 1.64.2, You can see p.join(), p.join(timeout) The effect of .
example , See the comments in the code for specific information
from multiprocessing import Process
from time import sleep
def worker(interval):
print("work start")
sleep(interval)
print("work end")
if __name__ == "__main__":
print(" The main process executes ")
# Create child process
p = Process(target=worker, args=(5,))
#p.join(timeout=1) # stay pycharm2021.3.1 in , It doesn't work ? No warning : ony for started process
#p.run() # perform run_test call ,pycharm You can also do so.
p.start() # idle Call only in , Don't execute ( But enforcement sleep The sentence of . There may be other ?),pycharm Medium can
p.join(timeout=1) # It doesn't work . The following end will not be executed first print, At the end of the execution sub process print
# The following is pycharm2017.2.7 Demonstration results in , But in pycharm2021.3.1 in , I don't know how to realize .
## Before executing the following statement , Need to wait for a period of time , Side subprocess execution
## To ensure that the main process always waits longer than the child process , use join function .
##p.join() # here , It will wait for the subprocess to finish executing before continuing the following statement . or
##p.join(timeout=10)
## there timeout Decide the order of execution :
## Less than the waiting time of the child process , First, execute the , Then execute the sub process ;
## Greater than the waiting time of the child process , Then execute the subsequent statements after executing the subprocess .
print(" The main process has finished executing ")
【vs code 1.64.2 Output result of 
边栏推荐
- Ethtool principle introduction and troubleshooting ideas for network card packet loss (with ethtool source code download)
- [idea] efficient plug-in save actions to improve your work efficiency
- [vscode] prohibit the pylance plug-in from automatically adding import
- Binary search (half search)
- GBK error in web page Chinese display (print, etc.), solution
- Basic series of SHEL script (II) syntax + operation + judgment
- And play the little chestnut of dynamic agent
- 第 2 章:小试牛刀,实现一个简单的Bean容器
- Netease to B, soft outside, hard in
- Typescript get timestamp
猜你喜欢

And play the little chestnut of dynamic agent

I implement queue with C I

How to modify the file path of Jupiter notebook under miniconda

Idea common settings

M2dgr slam data set of multi-source and multi scene ground robot

Self summary of college life - freshman

Basic series of SHEL script (III) for while loop

Concurrent programming - how to interrupt / stop a running thread?

What if the DataGrid cannot see the table after connecting to the database

M2DGR 多源多场景 地面机器人SLAM数据集
随机推荐
Detailed explanation of miracast Technology (I): Wi Fi display
Clickhouse database installation deployment and remote IP access
DelayQueue延迟队列的使用和场景
CADD course learning (5) -- Construction of chemosynthesis structure with known target (ChemDraw)
611. Number of effective triangles
[node] differences among NPM, yarn and pnpm
What if the DataGrid cannot see the table after connecting to the database
HDU1232 畅通工程(并查集)
Graduation thesis project local deployment practice
And let's play dynamic proxy (extreme depth version)
Play with grpc - go deep into concepts and principles
大学生活的自我总结-大一
Reading literature sorting 20220104
[software testing] 02 -- software defect management
I 用c l 栈与队列的相互实现
The number of occurrences of numbers in the offer 56 array (XOR)
Energy conservation and creating energy gap
GBK error in web page Chinese display (print, etc.), solution
[software testing] 05 -- principles of software testing
Pytorch has been installed in anaconda, and pycharm normally runs code, but vs code displays no module named 'torch‘