lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [lwip-users] SemSignal gets called on a already signaled semaphore


From: Goldschmidt Simon
Subject: RE: [lwip-users] SemSignal gets called on a already signaled semaphore
Date: Fri, 1 Jun 2007 09:17:47 +0200

> >>
> >> So waiting on a semaphore would mean:
> >> lock mutex
> >> while (count==0)
> >>   wait on condition variable
> >> count--
> >> unlock mutex
> >>
> >> And posting a semaphore:
> >> lock mutex
> >> count++
> >> signal condition variable
> >> unlock mutex
> > 
> > 
> > Jonathan,
> > 
> > As a clarification of the above example, is the intention for the 
> > mutex used by the semaphore pend to be the same as the one 
> used by the 
> > semaphore post? I imagine not, otherwise the pend would wait on the 
> > condition variable with the mutex locked, therefore 
> preventing a post 
> > from occurring...
> 
> It is the same mutex. Condition variables always have a mutex 
> associated with them. When you wait on a CV, the mutex is 
> automatically unlocked by the OS, and when you wake up after 
> the CV is signalled, the OS automatically relocks the mutex 
> before the wait function returns.
> 

Reading that explanation I'm afraid the OSes I use don't have such
condition variables! So making them mandatory for lwIP seems not
such a portable idea to me...


Simon




reply via email to

[Prev in Thread] Current Thread [Next in Thread]