used flock instead sem_* functions to be able to have exclusive and shared lock