关于php线程安全的问题
http://www.linuxso.com/security/22276...
很多常用的 PHP扩展是以Linux/Unix的多进程思想来开发的,这些扩展在ISAPI的方式运行时就会出错搞垮IIS。
请问这个出错搞垮是怎么做的呢?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
http://www.linuxso.com/security/22276...
很多常用的 PHP扩展是以Linux/Unix的多进程思想来开发的,这些扩展在ISAPI的方式运行时就会出错搞垮IIS。
请问这个出错搞垮是怎么做的呢?
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(2)
如果没有对多线程做特殊处理的话,任何会带来副作用的函数内都可能导致这个问题。
给你举个栗子:glibc的qsort函数在多线程使用的时候也可能会core。为什么呢?因为有一段代码是这样的
完整的代码阅读笔记可参考 glibc的qsort源码阅读笔记
顺便提一下,解决qsort问题的办法,是在主线程中先调用一次qsort,让它初始化了pagesize,这样只会就不会遇到竞争了。
Windows中运行PHP建议使用FastCGI方式,不会遇到线程安全问题。