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. QThread locks process on folder
Forum Update on Monday, May 27th 2025

QThread locks process on folder

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 389 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.
  • C Offline
    C Offline
    cronicryo
    wrote on last edited by
    #1

    i'm trying to convert qt's QFileInfoGatherer to python the code below is a stripped version of it. The issue im running into is that when QFileSystemWatcher is inside of the Thread it locks the folder if a folder is in its children.

    so lets say you have the folders:
    path/A
    path/A/B

    you cant delete A from an os level because a process is latched on you can however delete A AFTER B is deleted.

    How can i fix this? or what am I missing?

    from PySide.QtCore import *
    from PySide.QtGui import *
    
    class FileGatherer(QThread):
        def __init__(self, parent=None):
            super(FileGatherer, self).__init__(parent)
    
            self.muteX = QMutex()
            self.condition = QWaitCondition()
    
            self.abort = False
            self.paths = []
            self.watcher = QFileSystemWatcher(self)
    
            self.start(self.LowPriority)
        def run(self):
            while True:
                locker = QMutexLocker(self.muteX)
                if self.abort:
                    return
                if not len(self.paths):
                    print "waiting"
                    self.condition.wait(self.muteX)
                else:
                    print "running"
                locker.unlock()
    
    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