Added a thin abstraction layer over sem_wait and sem_post, because sem_wait was being interrupted by signals in the bytecode runtime; now I correctly call it in a loop