blob: 87fb0161f5f04e8ab36c319cab701e823c69861d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
import time
import unittest
from PySide.QtCore import QTime, QRunnable, QThreadPool
class Task(QRunnable):
def run(self):
t = QTime()
t.start()
time.sleep(2) # Sleep 2 seconds
class QThreadPoolTest(unittest.TestCase):
'''This used to cause a segfault due the ownership control on globalInstance function '''
def testSlowJobs(self):
for i in range(3):
task = Task()
QThreadPool.globalInstance().start(task)
time.sleep(1) # Sleep 1 second
QThreadPool.globalInstance().waitForDone()
if __name__ == '__main__':
unittest.main()
|