I am writing a program with a few critical sections. The thing is I need to check the value of a mutex in an if statement.
I would like to do something like this:
if pthread_mutex(&mutex) == 0 // locked
// Do something
else if pthread_mutex(&mutex) == 1 // unlocked
// Do something else
Is this possible?