This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: Condition Variables w/o mutual exclusion?
- To: Jonathan Larmour <jlarmour at redhat dot com>
- Subject: Re: [ECOS] Condition Variables w/o mutual exclusion?
- From: Grant Edwards <grante at visi dot com>
- Date: Tue, 2 Oct 2001 15:46:15 -0500
- Cc: ecos-discuss at sources dot redhat dot com
- References: <20011002134226.A31125@visi.com> <3BBA238C.F9153F41@redhat.com>
On Tue, Oct 02, 2001 at 09:29:00PM +0100, Jonathan Larmour wrote:
> > This implies that the thread may be awakened spuriously when
> > the event it is waiting for hasn't happened, but the first
> > sentence says that the thread can only be awakened by a
> > signal/broadcast. I don't understand why the loop is required
> > -- under what conditions will the thread be awakened when it
> > shouldn't be?
>
> When some other thread has satisfied the "condition" first.
Thanks. I was confusing "the condition" with "the condition
variable". The assumption seems to be that the call to
signal/broadcast is not sufficient condition to wake up a
thread, and that there's some other condition (which is to be
protected by the mutex) involved.
> If your mutex is not really _used_ for protecting anything,
Well, I'm not using it for anything. I thought maybe it was
needed internally by the cyg_cond_*() calls.
> you'll probably find you don't care.
That's the conclusion I've come to.
In my case, the DSR is waking up a set of tasks thay _may_ have
something to do once the DSR completes. The "have anything to
do" decisions are all dependant on the DSR having run, but
independant of each other. The mutex is handy when the "have
anything to do" decisions are somehow mutually exclusive.
--
Grant Edwards
grante@visi.com