Updated wait() and signal() to appropriate syntax