Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Using data from different thread
QtWS25 Last Chance

Using data from different thread

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 281 Views
  • 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.
  • S Offline
    S Offline
    Svirac
    wrote on last edited by
    #1

    Hi guys,

    Sorry for if this question was already occurred, it is related to Thread affinity.
    I read "you are doing it wrong" and I am following principles stated there.
    I don't experience app crashes, but just want to be sure.

    Is it safe to directly call data from another thread ? I am aware that I need to use mutex in that case.

    I have a situation that in main thread I am loading Settings from configuration file, and those data I am calling directly in separate thread (when thread is already moved/started).

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      Yes it's OK. If you are 100% sure you won't change that config during runtime, you can even do it without a mutex (but that is quite dangerous for hopefully obvious reasons).

      (Z(:^

      1 Reply Last reply
      5
      • S Offline
        S Offline
        Svirac
        wrote on last edited by
        #3

        Thanks for a replay, I appreciate it...

        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