This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Condition Variables w/o mutual exclusion?



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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]