python GIL

今天跑python多线程出了个奇怪的crash:
Fatal Python error: PyThreadState_Get: the function must be called with the GIL held, but the GIL is released (the current Python thread state is NULL)

找到如下参考:
https://superfastpython.com/thread-race-condition-shared-variable/
https://realpython.com/python-parallel-processing/
//www.greatytc.com/p/573aaa001b35

然后研究了半天,发现是有个线程因为崩溃,导致了这个问题,然后崩溃的log也没有打出来,还以为是GIL的问题。

迫使自己看了下GIL,又多了解一个python的限制了。

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容