我们从Python开源项目中,提取了以下8个代码示例,用于说明如何使用PyQt5.QtCore.QMutex()。
def __init__(self): QtCore.QThread.__init__(self) self.mutex = QtCore.QMutex() self.pack_opener = None self._isRunning = False
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, name, parent=None): super().__init__(name, parent) self.ui = plexdesktop.ui.downloadwindow_ui.Ui_DownloadWindow() self.ui.setupUi(self) self.mutex = QtCore.QMutex() self.setWindowTitle('Downloads') self.setWindowFlags(QtCore.Qt.Window) self.spacer = QtWidgets.QSpacerItem(1, 1, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) self.ui.layout.insertItem(-1, self.spacer) self.jobs = {} self.queue = queue.Queue()
def __init__(self, opts): QtCore.QThread.__init__(self) self.mutex = QtCore.QMutex() self.opts = opts self.email, self.password = "", "" self.anonymous = True
def __init__(self, parent): super(RequestHandler, self).__init__() self.parent = parent self.__terminated = False self.mutex = QMutex() self.waitForClick = QWaitCondition()
def __init__(self, parent=None): super(FileList, self).__init__(parent) self.stopped = False self.mutex = QMutex()
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