我们从Python开源项目中,提取了以下5个代码示例,用于说明如何使用PyQt5.QtCore.QWaitCondition()。
def start(self, table_name, sql_insert_queue, sql_insert_mutex, sql_insert_condition): # table_name = "dfdfd" # # sql_insert_queue = Queue.Queue() # sql_insert_mutex = QtCore.QMutex() # sql_insert_condition = QtCore.QWaitCondition() self.rw_lock = QtCore.QReadWriteLock() mftsize = (os.path.getsize(self.options.filename)) / 1024 self.mftsize = mftsize filename = self.options.filename self.mft_seqs_flag_list = [0] * self.mftsize # 0 empty, 1 parsering, 2 done. self.mft = {} self.thread_no = max(1, QtCore.QThread.idealThreadCount()) self.thread_no = 10 # 1'26'' self.thread_no = 1 # 1'12'' printself.thread_no self.thread_pool = [MftWorkerThread(self.mft, self.mft_seqs_flag_list, mftsize, filename, self.rw_lock, sql_insert_queue, sql_insert_mutex, sql_insert_condition, table_name, self.options, parent=self.parent) for _ in range(self.thread_no)] for thread in self.thread_pool: # thread.add_row_to_model_SIGNAL.connect(self.target_slot) # thread.update_progress_SIGNAL.connect(self.update_progress_slot) thread.start()
def __init__(self, mutex, item, destination, parent=None): super().__init__(parent) self.id = hash(item) self.item = item self.destination = destination self.cancelled = False self.paused = False self._pause = QtCore.QWaitCondition() self.thread = QtCore.QThread() self.worker = DownloadWorker(mutex) self.worker.moveToThread(self.thread) self.thread.start()
def __init__(self, parent): super(RequestHandler, self).__init__() self.parent = parent self.__terminated = False self.mutex = QMutex() self.waitForClick = QWaitCondition()
def __init__(self, serial): QThread.__init__(self) self.cond = QWaitCondition() self._status = False self.mutex = QMutex() self.serial = serial
def __init__(self): QThread.__init__(self) self.cond = QWaitCondition() self.mutex = QMutex() self.cnt = 0 self._status = True