问题
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