add compare function for semaphore_elem