<html><body>Hello,<div> I'd like to ask about behavior of sem_wait and sem_trywait. In description of sem_wait</div><div><br></div><div>> <span style="background-color:transparent">Decrement the value of this semaphore. If the new value would be negative,</span></div><div>> block and wait for someone to call sem_post() first.</div><div><br></div><div>Therefore it would block iff the initial value was less or equal to 0. However in sem_trywait</div><div><br></div><div>> <span style="background-color:transparent"> @retval EBUSY Semaphore has value of 0 and locking would block.</span></div><div><span style="background-color:transparent"><br></span></div><div>Why shouldn't I return EBUSY when value is negative?</div><div>Is there a reason I miss for which these two function behave differently?</div><div><br></div><div>Thank you</div><div>Martin Zimen</div><div><span style="background-color:transparent"><br></span></div></body></html>