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. how to properly pause and resume QThread execution?
Forum Updated to NodeBB v4.3 + New Features

how to properly pause and resume QThread execution?

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

    how to make threads to be in sleep or running state?

    kshegunovK 1 Reply Last reply
    0
    • K Kofr

      how to make threads to be in sleep or running state?

      kshegunovK Offline
      kshegunovK Offline
      kshegunov
      Moderators
      wrote on last edited by kshegunov
      #2
      QSemaphore barrier;
      
      // In thread supposed to sleep:
      barrier.acquire();
      
      // In thread that wakes the sleeping thread:
      barrier.release();
      

      Be careful though, because you're asking for trouble putting a thread to sleep for too long (it won't be able to process events) and also try not to deadlock it. :)

      Read and abide by the Qt Code of Conduct

      1 Reply Last reply
      4

      • Login

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