Synchronized functions using PHP

后端 未结 4 2114
被撕碎了的回忆
被撕碎了的回忆 2020-12-11 02:04

How to make functions in PHP synchronized so that same function won\'t be executed concurrently ? 2nd user must wait till 1st user is done with the function. Then 2nd user

4条回答
  •  北荒
    北荒 (楼主)
    2020-12-11 02:36

    You are looking for a Semaphore

    Bear in mind that using a semaphore (or any other blocking mechanism) can have serious peformance issues, as the requests can not be handled while the semaphore is up.

提交回复
热议问题