How to use monitors in PHP?

余生长醉 提交于 2019-12-12 02:34:16

问题


How to use monitors in PHP?


回答1:


I might be wrong but i thought that the server side model of execution of php is single threaded (aka no more than one thread). In fact i think this is one of reasons of PHP's success. If this is the case i doubt is relevant how do you use synchronization primitives in php.




回答2:


PHP is single threaded so there is no need for synchronization.




回答3:


PHP is single threaded, but if you want to have something like mutex between different processes and you use PHP5, you can simply use built-in session locking to achieve this. Just combine session_start and session_commit at correct places.



来源:https://stackoverflow.com/questions/4682120/how-to-use-monitors-in-php

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!