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
Forum Updated to NodeBB v4.3 + New Features

Using data from different thread

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 288 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.
  • S Offline
    S Offline
    Svirac
    wrote on 20 Mar 2019, 09:23 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
    • S Offline
      S Offline
      sierdzio
      Moderators
      wrote on 20 Mar 2019, 09:30 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 20 Mar 2019, 09:44 last edited by
        #3

        Thanks for a replay, I appreciate it...

        1 Reply Last reply
        0

        1/3

        20 Mar 2019, 09:23

        • Login

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