This is achieved by using a "lock" mechanism. Each possibly concurrent thread cooperates by acquiring
a lock before accessing the corresponding data.
Usage example:
if ($mutex->acquire($mutexName)) {
business logic execution
} else {
execution is blocked!
}
This is a base class, which should be extended in order to implement the actual lock mechanism.