当前位置:网站首页>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 
边栏推荐
- R language learning notes 1
- 2022.06.27_每日一题
- SD_ CMD_ SEND_ SHIFT_ REGISTER
- GBK error in web page Chinese display (print, etc.), solution
- CADD课程学习(6)-- 获得已有的虚拟化合物库(Drugbank、ZINC)
- Energy conservation and creating energy gap
- I 用c l 栈与队列的相互实现
- Intelligent target detection 59 -- detailed explanation of pytoch focal loss and its implementation in yolov4
- Simple operation with independent keys (hey, a little fancy) (keil5)
- Shadowless cloud desktop - online computer
猜你喜欢

DataGrid offline installation of database driver

借助 Navicat for MySQL 软件 把 不同或者相同数据库链接中的某数据库表数据 复制到 另一个数据库表中

(tool use) how to make the system automatically match and associate to database fields by importing MySQL from idea and writing SQL statements

Ethtool principle introduction and troubleshooting ideas for network card packet loss (with ethtool source code download)

With the help of Navicat for MySQL software, the data of a database table in different or the same database link is copied to another database table

And let's play dynamic proxy (extreme depth version)

M2DGR 多源多场景 地面机器人SLAM数据集
![[software testing] 02 -- software defect management](/img/2f/9987e10e9d4ec7509fa6d4ba14e84c.jpg)
[software testing] 02 -- software defect management

玩转gRPC—深入概念与原理

HDU1231 最大连续子序列(分治or动规or双指针)
随机推荐
C#学习笔记
[untitled]
(top) pretty girl binary color code portal
Netease to B, soft outside, hard in
2022 PMP project management examination agile knowledge points (7)
2022.06.27_每日一题
arcgis_ spatialjoin
行测--资料分析--fb--高照老师
Basic series of SHEL script (II) syntax + operation + judgment
Anaconda navigator click open no response, can not start error prompt attributeerror: 'STR' object has no attribute 'get‘
(tool use) how to make the system automatically match and associate to database fields by importing MySQL from idea and writing SQL statements
公安基础知识--fb
Ethtool principle introduction and troubleshooting ideas for network card packet loss (with ethtool source code download)
D2L installation
Machine learning Seaborn visualization
[tf1] save and load parameters
Professional knowledge of public security -- teacher bilitong
Batch convert txt to excel format
Unconventional ending disconnected from the target VM, address: '127.0.0.1:62635', transport: 'socket‘
selenium 元素定位