in reply to Critical section FCFS

The module Thread::Semaphore is what you may be looking for!!