Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. The Lounge
  4. MutliThread application and cuncurrent data access
Forum Updated to NodeBB v4.3 + New Features

MutliThread application and cuncurrent data access

Scheduled Pinned Locked Moved The Lounge
2 Posts 2 Posters 1.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    luca
    wrote on last edited by
    #1

    Hi all,
    I have some doubts in multithread data access:

    1. What does it happens if 2 threads read same data in memory without synchronization? does the application crash?
    2. 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?
    1 Reply Last reply
    0
    • JKSHJ Offline
      JKSHJ Offline
      JKSH
      Moderators
      wrote on last edited by
      #2

      Hi,

      I recommend reading http://doc-snapshot.qt-project.org/qt5-stable/threads-synchronizing.html

      1. 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.

      2. 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.

      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved