Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Also the update of the write pointer could be reordered to occur before storage of the actual data flushed to the buffer.

      e.g.
      buf[volatile_write_ptr] = c
      volatile_write_ptr++;
might occur the other way 'round for the code that is reading from buf[].

For typical "simple" single processor controllers this will not be an issue, though, and "volatile"+spinlocks/disenable-enable-interrupts will work just fine.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: