[ECOS] I/O thread safety

Stanislav Meduna stano@meduna.org
Tue Sep 15 11:12:00 GMT 2009


I'd like to ask whether and how is the thread-safety
of the I/O subsystem approached - is this a problem
of application code, each subsystem, each driver,...?

I am implementing a driver for a CAN controller
connected via a SPI interface. Each CAN controller
transaction requires a few separate SPI transactions
that should not be interrupted by transactions done
from another thread (this can be probably fixed
to do everything in one SPI transaction, but
I'd like to ask anyway).

I am accessing the driver via the CYGPKG_IO_CAN layer.
The reads are normally executed by a message event loop
in one thread blocking until a CAN message arrives,
the writes are done from another thread.

To make things even more interesting both the SPI
and the CAN device are interrupt-driven...

What is the suggested approach to make this thread-safe?
A pointer to some example code is enough.


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