This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
RE: Condition Variables recap
- To: "'Jonathan Larmour'" <jlarmour at redhat dot com>
- Subject: RE: [ECOS] Condition Variables recap
- From: "Trenton D. Adams" <tadams at extremeeng dot com>
- Date: Tue, 24 Jul 2001 14:00:09 -0600
- Cc: "'eCos mailing list'" <ecos-discuss at sources dot redhat dot com>
- Organization: Extreme Engineering
Jonathan Larmour wrote:
>
> Shouldn't only one thread need to process the arrived data? With
> _broadcast(), all of them will wake up. But still, I don't know your
> application, so it's up to you. If it works for you, whatever :).
>
Actually, I'm looking at my design document, and I only have one thread
accessing the data! Sorry for the confusion!!! I asked the question
before I started writing that part of the design document.
> > Is there any way that two of the threads could accidentally lock a
> mutex
> > at the exact same time and not even know it?
>
> No. Unless you misuse the API (e.g. by calling cyg_mutex_trylock()
and
> don't check the return code).
>
cyg_mutex_trylock () is not documented in my documentation. I assume
I'm not required to call that before the actual locking?
Gary Thomas wrote:
> > Is there any way that two of the threads could accidentally lock
a
> > mutex at the exact same time and not even know it? I would think
that
> > it doesn't really matter as long as the resource required is
meant to
> > be read-only to the consumer threads right?
> No - if this were possible, then it would not be a mutex! (mutex =
device for _mutual exclusion_)
Yes, I figured that much, I just wanted to be sure! ;)
Thanks for the info Jonathan and Gary, I think I'm almost ready for some
serious coding! Assuming I can get that stupid PCMCIA controller to
quit screwing with my head! :)