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: ecos-discuss at sources dot redhat dot com
- Subject: Re: [ECOS] Condition Variables w/o mutual exclusion?
- From: Hugo Tyson <hmt at redhat dot com>
- Date: 03 Oct 2001 12:15:13 +0100
- References: <20011002134226.A31125@visi.com>
Grant Edwards <grante@visi.com> writes:
> I need a mechanism for one or more threads to block until an
> event happens inside a DSR. Something like a flag bit would be
> perfect, but according to the table at
> http://sources.redhat.com/ecos/docs-latest/ref/ecos-ref.13.html#pgfId=1080419
> condition variables are the only mechanism usable from a DSR.
It's lying ;-( As Jifl says, perhaps based on dogma ;-)
You can indeed use a flag object - again, so long as you only do operations
which cannot block within the DSR.
Beware though that a flag "setbits" has broadcast semantics (which is what
you want), so it will take time - perhaps a lot of time - proportional to
the number of threads that were waiting. *That*'s the reason using this
primitive in a DSR might be recommended against.
The network code contains (in src/ecos/timeout.c)
void ecos_synch_eth_drv_dsr(void)
{
cyg_flag_setbits( &alarm_flag, 2 );
}
which is called from the device driver DSR to awaken the network delivery
thread. Since we do this ourselves, I don't see that we can honestly
recommend against it!
- Huge