Implementation of FileSemaphore