Home
Sign Up
Sign In
推荐学习书目
›
Learn Python the Hard Way
Python Sites
›
PyPI
- Python Package Index
›
http://diveintopython.org/toc/index.html
›
Pocoo
值得关注的项目
›
PyPy
›
Celery
›
Jinja2
›
Read the Docs
›
gevent
›
pyenv
›
virtualenv
›
Stackless Python
›
Beautiful Soup
›
结巴中文分词
›
Green Unicorn
›
Sentry
›
Shovel
›
Pyflakes
›
pytest
Python 编程
›
pep8 Checker
Styles
›
PEP 8
›
Google Python Style Guide
›
Code Style from The Hitchhiker's Guide
V2EX
›
Python
Python3.6 新版 Thread 还是会阻塞主线程吗?
1
miniyao
·
Mar 22, 2018
· 4525 views
This topic created in 3153 days ago, the information mentioned may be changed or developed.
试了一下在 Thread 中新启一个任务,然后在这个任务里 time.sleep(60),然后整个应用的主线程就全阻塞了。
thread
阻塞
主线
Python
7 replies
•
2018-03-23 14:03:32 +08:00
aisk
Mar 22, 2018
1
之前就不会阻塞,你是不是在主线程里调用 join 或者 wait 了?
miniyao
OP
Mar 22, 2018
2
@
aisk
想起来了,在这个 Thread 中有 IO 操作了,所以 GIL 不释放
toono
Mar 22, 2018
3
@
miniyao
我印象中 IO 操作是会释放 GIL 的。
tkmiles
Mar 23, 2018
4
发发代码来看看呀~~~
凭空怎么看问题嘛
tkmiles
Mar 23, 2018
5
@
aisk
join 和 wait 都是等锁, C 代码会释放 gil 的
wwqgtxx
Mar 23, 2018
6
除非你调用了某个忘记释放 gil 的垃圾第三方库,否则不会出现这种情况的
就算是你要 ctypes 和 cffi 来调用第三方 dll 的时候都一样会释放 gil
Linxing
Mar 23, 2018 via iPhone
7
话说上次调用 telebot 就算这样锁死的 找了好久才发现问题 提 bug 了
About
·
Help
·
Advertise
·
Blog
·
API
·
FAQ
·
Privacy
·
Solana
·
1604 Online
Highest 6679
·
Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 32ms ·
UTC 14:25
·
PVG 22:25
·
LAX 06:25
·
JFK 09:25
♥ Do have faith in what you're doing.
❯