Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Synchronized functions using PHP

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 can execute the function.

Thanks

like image 257
Techie Avatar asked Sep 19 '12 11:09

Techie


1 Answers

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.

like image 159
JvdBerg Avatar answered Sep 21 '22 19:09

JvdBerg