Suppose that I have a function in php like:
function post_data()
{
// Do the job
}
Now I want this function to complete for the current visitor first before other visitors enter the function. Other visitors should pass this function and do the remaining script jobs. I searched for this problem too much but could not find a proper answer. What I found is that to use flock() php function. I tried flock() and it worked best for me but I want an independent solution to this.
So how can this function be locked for one visitor before other enter the function without using flock()?