Makes a single attempt to acquire the resource protected by a semaphore.
#include <synch.h> int sema_trywait ( sema_t *sp );
(IN) Points to the semaphore to acquire.
If successful in acquiring the semaphore, returns 1 (TRUE); otherwise returns 0 (FALSE).
If the semaphore count is greater than zero, sem_trywait decrements the semaphore value and returns TRUE to indicate a successful acquisition of the resource. If the semaphore value is less than or equal to zero, the semaphore cannot be immediately acquired. Because sem_trywait cannot block and wait for the resource to become available, the function returns FALSE to indicate failure and does not modify the semaphore value.