Answer by Grégory Vaumourin for Need for Mutex while using Shared Memory...
The problem in your case is the reader can read at the same time as the variable is being written , the problem is only the write so I suggest you to use atomic operations for this write so you won't...
View ArticleAnswer by Schafwolle for Need for Mutex while using Shared Memory (C++) for...
It depends on your implementation if you are using preemtive tasks (E.g Interrupts). Its possible that the reading thread is reading the value and during reading is interrupted by the writing thread....
View ArticleAnswer by DrDonut for Need for Mutex while using Shared Memory (C++) for...
I don't know if this answer is supposed to be a comment, if it is, please let me know...You could try to implement a circular buffer. This way, the writer has a pointer that just rotates through the...
View ArticleNeed for Mutex while using Shared Memory (C++) for hardware applications
I have a sensor that is writing data to shared memory in a thread at n Hz (say 10Hz=10 times per second). A separate thread is reading this data and using it to acquire some result. The frequency of...
View Article