This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

C6748 memory bus 16bit and thread safe variables

Hello,

I was wondering if accessing a variable char, 16bit, 32bit or floats is thread safe for writing in a thread/interrupt/main code and reading it from another thread/interrupt/main code considering the memory interface is 16bit on this processor?

Is it guaranteed that updating it will not have half old and half new values? Where could I find more information, since I couldn't find anything on the forum?

Thank you in advance,

David.

  • David,

    Are concerned about the 32-bit variable only being half updated by one thread before it gets preempted by another thread that reads that variable and gets the half updated value? Yes, that can happen but that's why there are synchronization modules (Semaphores, Gates, Mutexes) you are supposed to use to guarantee that your memory accesses are thread-safe.

    Moses

  • Yes, that's what I was thinking too, just wasn't sure. We have a few floats that are updated periodically and thought that we might skip some RTOS calls for speed.

    Thank you for clarification.