I am writing a spi driver component and an example client component. I
need a way of protecting the communication between them. To that end I am
implementing some buffer locking. I was given a suggestion on the linuxcnc
user's list of using a ring buffer. I'm pondering that too.
To that end: Is increment (and the subsequent store) an atomic operation
on x86? Anyone know if it is also atomic for beagleboneblack, raspberry
pi, and other common arm processors? I think it was atomic on some of the
MCU's that I have used in the past (MSP430) I'm considering changing the
flag bit that I am using to a "request counter" that I increment and then
see if there are more than one process accessing the buffer before I make
changes to the data. Something like
bufflock++;
if (bufflock>1) bufflock--;
else {
// Do things to the buffer
bufflock--; // All done, decrement back to 0.
}
Anyone have other atomic methods I can use to this end (perhaps with a code
example?)
Thanks,
Matt
------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Emc-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-developers