Can I call semaphore.wait() within mutex_lock if in the path somehow it can be guaranteed that resource protected by the semaphore is available?
I.e. I want to do something like following:
void some_function {
mutex_lock()
// Do something
if (certain_conditions == TRUE) {
semaphore_wait() // Guaranteed that resource is available.
// Can not get blocked for sure.
}
// Do some more things
mutex_unlock()
}
if (certain_conditions = TRUE)is not what you want (use==): please post acutal code not "something-like" code. - Weather Vaneassert()success. - PSkocik