[ECOS] is cyg_io_read atomic process

Andrew Lunn andrew@lunn.ch
Thu Mar 10 12:47:00 GMT 2005

On Wed, Mar 09, 2005 at 06:23:32PM -0800, steve smith wrote:
> if I do cyg_io_read in a lower priority thread, and once the
> cyg_io_read starts reading the buffer will it get preempted in the
> middle of the reading by a higher priority thread(which has become
> ready to execute) OR an interrupt? or is it an atomic process?
> I am using a AT91R40006 micro, with the hardware serial driver for the
> cyg_io_read.
> thanks.

Interrupts can happen. 

There are multiple buffers involved. eg the hardware itself will have
a buffer and the driver keeps a buffer of charactors which have been
received but not yet read by a thread. This buffer has a mutex so
preventing two readers reading the buffer at once.

DSR are also locked when performing the copy from the buffer into the
readers buffer. This will in effect stop context switches since they
are triggered from DSRs, but this is just during the read from the

If you are doing a read and there are no charactors to read, it then
blocks and a context switch can happen, but thats obvious....


Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

More information about the Ecos-discuss mailing list