[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    [PyKDE] really wierd qthread + emit issue
From:       Matt Chambers <chambers () imageworks ! com>
Date:       2006-11-22 0:54:12
Message-ID: 45639FB4.2020606 () imageworks ! com
[Download RAW message or body]

Using PyQt 4.0 and Qt 4.1.  I'm emitting a single from a QThread with a 
single argument.   About 50% of the time when  I catch
the signal and execute the slot function, the argument is a QMutex 
object, not the argument I emitted with the signal.

Here is my threads run() function.

    def run(self):
            while self.__running:
                job_name = None      
                self.__parent._q_mutex.lock()
                if len(self.__parent._q_queue) == 0:
                    _log.debug("Thread-%d waiting for data" % (self.__name))
                    self.__parent._q_empty.wait(self.__parent._q_mutex)
                else:
                    job_name = self.__parent._q_queue.pop(0)
                self.__parent._q_mutex.unlock()
               
                if job_name:
                    _log.debug("thread-%d parsing cue job log" % 
self.__name)
                    try:
                        cjob = 
cuejob.CueJob(job_name[0:job_name.find("-")],job_name)
                        cjob.profile()
                        self.emit(QtCore.SIGNAL("parsingComplete"),cjob)
                    except Exception,e:
                        _log.debug("Error parsing cue job: %s" % (e))
                       
            _log.debug("Thread Stopping")


Notice I'm emitting the signal with a cuejob.CueJob object, but from the 
slot, when I print the first argument, I get:
<PyQt4.QtCore.QMutex object at 0xf6b0b22c>

Matt

_______________________________________________
PyKDE mailing list    PyKDE@mats.imk.fraunhofer.de
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic