当前位置:网站首页>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 
边栏推荐
- How to delete the virus of inserting USB flash disk copy of shortcut to
- 氫氧化鈉是什麼?
- ORACLE CREATE SEQUENCE,ALTER SEQUENCE,DROP SEQUENCE
- M2dgr slam data set of multi-source and multi scene ground robot
- 使用go语言读取txt文件写入excel中
- [tf1] save and load parameters
- Negative number storage and type conversion in programs
- Basic series of SHEL script (III) for while loop
- How to deal with excessive memory occupation of idea and Google browser
- Import CV2 prompt importerror: libgl so. 1: Cannot open shared object file: no such file or directory
猜你喜欢

Rough notes of C language (1)
![[idea] efficient plug-in save actions to improve your work efficiency](/img/6e/49037333964865d9900ddf5698f7e6.jpg)
[idea] efficient plug-in save actions to improve your work efficiency
![When jupyter notebook is encountered, erroe appears in the name and is not output after running, but an empty line of code is added downward, and [] is empty](/img/fe/fb6df31c78551d8908ba7964c16180.jpg)
When jupyter notebook is encountered, erroe appears in the name and is not output after running, but an empty line of code is added downward, and [] is empty

How to delete the virus of inserting USB flash disk copy of shortcut to

SOC_ SD_ DATA_ FSM

Line test -- data analysis -- FB -- teacher Gao Zhao

Word import literature -mendeley

Ugnx12.0 initialization crash, initialization error (-15)

Netease to B, soft outside, hard in

Concurrent programming - how to interrupt / stop a running thread?
随机推荐
arcpy. SpatialJoin_ Analysis spatial connection analysis
第 2 章:小试牛刀,实现一个简单的Bean容器
[software testing] 05 -- principles of software testing
【idea】Could not autowire. No beans of xxx type found
Daily Practice:Codeforces Round #794 (Div. 2)(A~D)
The golang timer uses the stepped pit: the timer is executed once a day
What if the DataGrid cannot see the table after connecting to the database
ORACLE CREATE SEQUENCE,ALTER SEQUENCE,DROP SEQUENCE
I 用c l 栈与队列的相互实现
DataGrid offline installation of database driver
Matrix keyboard scan (keil5)
IPage can display data normally, but total is always equal to 0
Web page Chinese display (print, etc.) GBK error, solution, software
[idea] efficient plug-in save actions to improve your work efficiency
SD_ CMD_ RECEIVE_ SHIFT_ REGISTER
2022年PMP项目管理考试敏捷知识点(7)
Eclipse project recompile, clear cache
CADD课程学习(6)-- 获得已有的虚拟化合物库(Drugbank、ZINC)
DelayQueue延迟队列的使用和场景
PostMessage communication