#include <thread.h> int sema_wait(sema_t *sp);
Use sema_wait(3T) to block the calling thread until the count in the semaphore pointed to by sp becomes greater than zero, then atomically decrement it.