Added optional nowait argument to sem_acquire