Move sem_init() to constructor and add missing sem_destroy()