//The thread acquires the lock before it enters the ciritical section. If there is a car on the bridge (another thread has the lock) then we wait. While the car is crossing, we increment he car_on_bridge by 1, reaching bridge capacity.We simulate the crossing bridge time using usleep.The car crosses, we decrement the car_on_bridge and print out a message that the car has crossed, then we increment the crosses_counter and release the lock so that it can be obtained by other cars(threads).