MutliThread application and cuncurrent data access
I have some doubts in multithread data access:
- What does it happens if 2 threads read same data in memory without synchronization? does the application crash?
- What does it happens if 2 threads write data in the same memory area? does the application crash or I only get possible wrong data in the memory?
I recommend reading http://doc-snapshot.qt-project.org/qt5-stable/threads-synchronizing.html
If the data is guarantee to not change while it's being read, this is fine. See the description for QReadWriteLock in the link above.
You will probably get data corruption. Data corruption can cause crashes, or it can fail silently -- this depends on your code. Note: In these situations, crashes are good because they tell you that something is wrong. If your app DOESN'T crash, then you won't know if your data is destroyed.