[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-users] SemSignal gets called on a already signaled semaphore
From: |
clive |
Subject: |
Re: [lwip-users] SemSignal gets called on a already signaled semaphore |
Date: |
Fri, 01 Jun 2007 13:20:26 +0100 |
User-agent: |
Demon-WebMail/2.0 |
address@hidden wrote:
> Goldschmidt Simon wrote:
> >>>>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...
>
> Really? I'm amazed if so. Any OSes I should have heard of, or homegrown? I
> am sort of assuming that if someone can write a homegrown OS they can
> implement mutexes/condition variables for it if they need to.
Well, that's the reason for my needing a clarification. The OS I'm using (VDK,
Analog Devices' RTOS for their DSPs) has no such condition variable, and I
don't think it's unique in that regard either.
Kind regards,
Clive Wilson
- RE: [lwip-users] SemSignal gets called on a already signaled semaphore, Goldschmidt Simon, 2007/06/01
- Re: [lwip-users] SemSignal gets called on a already signaled semaphore, Jonathan Larmour, 2007/06/01
- Re: [lwip-users] SemSignal gets called on a already signaled semaphore,
clive <=
- Re: [lwip-users] SemSignal gets called on a already signaled semaphore, Jonathan Larmour, 2007/06/01
- RE: [lwip-users] SemSignal gets called on a already signaled semaphore, Goldschmidt Simon, 2007/06/01
- Re: [lwip-users] SemSignal gets called on a already signaled semaphore, Jonathan Larmour, 2007/06/01
- RE: [lwip-users] SemSignal gets called on a already signaled semaphore, Goldschmidt Simon, 2007/06/01
- Re: [lwip-users] SemSignal gets called on a already signaled semaphore, Jonathan Larmour, 2007/06/01
- RE: [lwip-users] SemSignal gets called on a already signaled semaphore, Goldschmidt Simon, 2007/06/01