waits for a signal emitted from a thread and updates the gui
        Args:
            progress:
        Returns:
337718
def update_status(self, progress):
        

        # interval at which the gui will be updated, if requests come in faster than they will be ignored
        update_interval = 0.2

        now = datetime.datetime.now()

        if not self._last_progress_update is None and now-self._last_progress_update < datetime.timedelta(seconds=update_interval):
            return

        self._last_progress_update = now

        self.progressBar.setValue(progress)

        script = self.current_script

        # Estimate remaining time if progress has been made
        if progress:
            remaining_time = str(datetime.timedelta(seconds=script.remaining_time.seconds))
            self.lbl_time_estimate.setText('time remaining: {:s}'.format(remaining_time))
        if script is not str(self.tabWidget.tabText(self.tabWidget.currentIndex())).lower() in ['scripts', 'instruments']:
            self.plot_script(script)
903980
def wait_for_child_and_forward_all_signals(child_pid, process_name):
    
    assert _HAS_SIGWAIT
    block_all_signals()

    while True:
        logging.debug("Waiting for signals")
        signum = signal.sigwait(_ALL_SIGNALS)
        if signum == signal.SIGCHLD:
            pid, exitcode, ru_child = os.wait4(-1, os.WNOHANG)
            while pid != 0:
                if pid == child_pid:
                    return exitcode, ru_child
                else:
                    logging.debug("Received unexpected SIGCHLD for PID %s", pid)
                pid, exitcode, ru_child = os.wait4(-1, os.WNOHANG)

        else:
            _forward_signal(signum, child_pid, process_name)
974913
def _do_watch_progress(filename, sock, handler):
    """"""
    connection, client_address = sock.accept()
    data = b''
    try:
        while True:
            more_data = connection.recv(16)
            if not more_data:
                break
            data += more_data
            lines = data.split(b'\n')
            for line in lines[:-1]:
                line = line.decode()
                parts = line.split('=')
                key = parts[0] if len(parts) > 0 else None
                value = parts[1] if len(parts) > 1 else None
                handler(key, value)
            data = lines[-1]
    finally:
        connection.close()
1065543
def make_update_loop(thread, update_func):
    
    while not thread.should_stop():
        if thread.should_pause():
            thread.wait_to_resume()

        start = time.time()
        if hasattr(thread, '_updated'):
            thread._updated.clear()
        update_func()
        if hasattr(thread, '_updated'):
            thread._updated.set()
        end = time.time()

        dt = thread.period - (end - start)

        if dt > 0:
            time.sleep(dt)
339000
def finish(self):
        ''

        self.finished = True
        self.update(self.maxval)
        self.fd.write('\n')
        if self.signal_set:
            signal.signal(signal.SIGWINCH, signal.SIG_DFL)
706461
def _on_progress(adapter, operation, conn_id, done, total):
    """"""

    conn_string = adapter._get_property(conn_id, 'connection_string')
    if conn_string is None:
        return

    adapter.notify_progress(conn_string, operation, done, total)
1176471
public boolean notifyProgress(double progress) {

    boolean result = true;

    for (ProgressMonitor monitor : this.monitors) {
      if (!monitor.notifyProgress(progress)) {
        result = false;
      }
    }

    return result;

  }
547676
def notify_batches_finished(self, statuses):
        
        with self._wait_condition:
            self._statuses = statuses
            self._wait_condition.notify()
681514
def wait_until_exit(self):
        

        if self._timeout is None:
            raise Exception("Thread will never exit. Use stop or specify timeout when starting it!")

        self._thread.join()
        self.stop()
94818
def _thread_worker(self):
        """"""
        while self._running:
            # Retrieve next cmd, or block
            packet = self._queue.get(True)
            if isinstance(packet, dict) and QS_CMD in packet:
                try:
                    self._callback_listen(packet)
                except Exception as err:  # pylint: disable=broad-except
                    _LOGGER.error("Exception in callback\nType: %s: %s",
                                  type(err), err)
            self._queue.task_done()
16075
def wait(self):
        
        running = True
        while running and self.messages_pending():
            running = self.do_work()
        return running
1043236
def waitResult(self):
    
    self.thread.execute_queue.join()
    try:
      e = self.thread.exception_queue[threading.get_ident()].get_nowait()
    except queue.Empty:
      return self.thread.result_queue[threading.get_ident()].get_nowait()
    else:
      raise e
567515
def progress(self, *msg):
        
        label = colors.purple("Progress")
        self._msg(label, *msg)
1281731
def update_progress(opts, progress, progress_iter, out):
    '''
    
    '''
    # Look up the outputter
    try:
        progress_outputter = salt.loader.outputters(opts)[out]
    except KeyError:  # Outputter is not loaded
        log.warning('Progress outputter not available.')
        return False
    progress_outputter(progress, progress_iter)
977024
def update_data_run(self, event_to_wait_on):
        
        # with the daemon=Turue setting, this thread should
        # quit 'automatically'
        while event_to_wait_on.wait():
            event_to_wait_on.clear()
            if self.update_data_callback_kill_event.is_set():
                return
            self.update_data_func()
768046
def wait_for_signal(self, timeout=None):
		
		timeout_ms = int(timeout * 1000) if timeout else win32event.INFINITE
		win32event.WaitForSingleObject(self.signal_event, timeout_ms)
169100
def _wait_while_in_pause_or_in_step_mode(self):
        
        while (self._status.execution_mode is StateMachineExecutionStatus.PAUSED) \
                or (self._status.execution_mode is StateMachineExecutionStatus.STEP_MODE):
            try:
                self._status.execution_condition_variable.acquire()
                self.synchronization_counter += 1
                logger.verbose("Increase synchronization_counter: " + str(self.synchronization_counter))
                self._status.execution_condition_variable.wait()
            finally:
                self._status.execution_condition_variable.release()