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. QEventLoop created in 1 thread, exec in another one and exit in the first thread
Forum Updated to NodeBB v4.3 + New Features

QEventLoop created in 1 thread, exec in another one and exit in the first thread

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 4.0k 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.
  • 2 Offline
    2 Offline
    2beers
    wrote on last edited by
    #1

    Hi everyone. I'm trying to understand how QEventLoop is working.
    I have one application that uses 2 threads. I create a QEventLoop in 1 thread , start the loop(exec) in the second thread, and stop(exit) it the first thread.
    It shows me that the loop has been stoped, but in reallity id didn't.

    Now if I create The QEventLoop in the same thread as it starts(exec) and stop it from the other thread works great.

    I'm interested why is happening this? why was my first example wrong, and why is the second example working?

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #2

      AFAIK: An eventloop is designed to be used by only one thread. There is no telling what happens if you start messing with one from different threads. Simply don't do that.

      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