Start Dut thread.

        :return: Nothing
330715
def start_dut_thread(self):  # pylint: disable=no-self-use
        
        if Dut._th is None:
            Dut._run = True
            Dut._sem = Semaphore(0)
            Dut._signalled_duts = deque()
            Dut._logger = LogManager.get_bench_logger('Dut')
            Dut._th = Thread(target=Dut.run, name='DutThread')

            Dut._th.daemon = True
            Dut._th.start()
309135
def start(self):
        
        if not (self.__recv_thread or self.__send_thread):
            self.__end.clear()
            self.__send_ready.clear()
            self.__recv_ready.clear()
            timeout = self.__socket_timeout + 1
            ignore_exc = self.__startup_ignore_exc
            self.__send_exc_clear()
            self.__recv_exc_clear()

            # start & await send thread success (unless timeout reached or an exception has occured)
            self.__send_thread = Thread(target=self.__send_run, name='amqplink_send')
            self.__send_thread.start()
            start_time = monotonic()
            success = False
            while not (success or (not ignore_exc and self.__send_exc) or monotonic() - start_time > timeout):
                success = self.__send_ready.wait(.25)

            if success:
                # start & await receiver thread success
                self.__recv_thread = Thread(target=self.__recv_run, name='amqplink_recv')
                self.__recv_thread.start()
                start_time = monotonic()
                success = False
                while not (success or (not ignore_exc and self.__recv_exc) or monotonic() - start_time >= timeout):
                    success = self.__recv_ready.wait(.25)

            # handler either thread's failure
            if not success:
                logger.warning("AmqpLink Failed to start.  Giving up.")
                self.stop()
                if self.__recv_exc:
                    # prioritise receive thread since this can get access-denied whereas send does not (until sending)
                    raise_from(LinkException('Receive thread failure'), self.__recv_exc)
                elif self.__send_exc:
                    raise_from(LinkException('Send thread failure'), self.__send_exc)
                else:
                    raise LinkException('Unknown link failure (timeout reached)')

        else:
            raise LinkException('amqplink already started')
906751
def run(self):
        """"""
        while not self.stopped.isSet():
            try:
                # if the current state is idle, just block and wait forever
                # if the current state is any other state, then a timeout of 200ms should
                # be reasonable in all cases.
                timeout = (self._state != 'idle') and 0.2 or None
                rdlist, _, _ = select.select([self._socket.fileno()], [], [], timeout)
                if not rdlist:
                    if self._state != 'idle':
                        self._state = 'idle'
                    continue
                data = self._socket.recv(1024)
                if not data:
                    # check if the socket is still valid
                    try:
                        os.fstat(recv._socket.fileno())
                    except socket.error:
                        break
                    continue
                code = utils.mangleIR(data, ignore_errors=True)
                codeName = self.codeMap.get(code)
                # some manufacturers repeat their IR codes several times in rapid
                # succession. by tracking the last code, we can eliminate redundant
                # state changes
                if codeName and (self._state != codeName):
                    self._state = codeName
                    for callback in self._callbacks:
                        callback(codeName)
            except:
                time.sleep(0.1)
736269
def run(self, timeout=None, **kwargs):
        
        from subprocess import Popen, PIPE

        def target(**kw):
            try:
                # print('Thread started')
                self.process = Popen(self.command, **kw)
                self.output, self.error = self.process.communicate()
                self.retcode = self.process.returncode
                # print('Thread stopped')
            except:
                import traceback
                self.error = traceback.format_exc()
                self.retcode = -1

        # default stdout and stderr
        if 'stdout' not in kwargs:
            kwargs['stdout'] = PIPE

        if 'stderr' not in kwargs:
            kwargs['stderr'] = PIPE

        # thread
        import threading
        thread = threading.Thread(target=target, kwargs=kwargs)
        thread.start()
        thread.join(timeout)

        if thread.is_alive():
            # print("Terminating process")
            self.process.terminate()
            self.killed = True
            thread.join()

        return self
542162
def start(self):
        '''
        
        '''
        if self._started:
            self.logger.warning('called while fuzzer is running. ignoring.')
            return
        self._started = True
        assert(self.model)
        assert(self.user_interface)
        assert(self.target)

        if self._load_session():
            self._check_session_validity()
            self._set_test_ranges(
                self.session_info.start_index,
                self.session_info.end_index,
                self.session_info.test_list_str
            )
        else:
            self.session_info.kitty_version = _get_current_version()
            # TODO: write hash for high level
            self.session_info.data_model_hash = self.model.hash()
        # if self.session_info.end_index is None:
        #     self.session_info.end_index = self.model.last_index()
        if self._test_list is None:
            self._test_list = StartEndList(0, self.model.num_mutations())
        else:
            self._test_list.set_last(self.model.last_index())

        list_count = self._test_list.get_count()
        self._test_list.skip(list_count - 1)
        self.session_info.end_index = self._test_list.current()
        self._test_list.reset()
        self._store_session()
        self._test_list.skip(self.session_info.current_index)
        self.session_info.test_list_str = self._test_list.as_test_list_str()

        self._set_signal_handler()
        self.user_interface.set_data_provider(self.dataman)
        self.user_interface.set_continue_event(self._continue_event)
        self.user_interface.start()

        self.session_info.start_time = time.time()
        try:
            self._start_message()
            self.target.setup()
            start_from = self.session_info.current_index
            if self._skip_env_test:
                self.logger.info('Skipping environment test')
            else:
                self.logger.info('Performing environment test')
                self._test_environment()
            self._in_environment_test = False
            self._test_list.reset()
            self._test_list.skip(start_from)
            self.session_info.current_index = start_from
            self.model.skip(self._test_list.current())
            self._start()
            return True
        except Exception as e:
            self.logger.error('Error occurred while fuzzing: %s', repr(e))
            self.logger.error(traceback.format_exc())
            return False
140798
def start_daemon_thread(target, args=()):
    """"""
    th = Thread(target=target, args=args)
    th.daemon = True
    th.start()
    return th
677191
def thread(self):
        
        log.info('@{}.thread starting'.format(self.__class__.__name__))
        thread = threading.Thread(target=thread_wrapper(self.consume), args=())
        thread.daemon = True
        thread.start()
425548
def init_generic_serial_dut(contextlist, conf, index, args):
    
    port = conf['serial_port']
    baudrate = (args.baudrate if args.baudrate else conf.get(
        "application", {}).get("baudrate", 115200))
    serial_config = {}
    if args.serial_rtscts:
        serial_config["serial_rtscts"] = args.serial_rtscts
    elif args.serial_xonxoff:
        serial_config["serial_xonxoff"] = args.serial_xonxoff

    if args.serial_timeout:
        serial_config["serial_timeout"] = args.serial_timeout

    ch_mode_config = {}
    if args.serial_ch_size > 0:
        ch_mode_config["ch_mode"] = True
        ch_mode_config["ch_mode_chunk_size"] = args.serial_ch_size
    elif args.serial_ch_size is 0:
        ch_mode_config["ch_mode"] = False

    if args.ch_mode_ch_delay:
        ch_mode_config["ch_mode_ch_delay"] = args.ch_mode_ch_delay
    dut = DutSerial(name="D%d" % index, port=port, baudrate=baudrate,
                    config=conf, ch_mode_config=ch_mode_config,
                    serial_config=serial_config, params=args)
    dut.index = index

    dut.platform = conf.get("platform_name", "serial")

    msg = 'Use device in serial port {} as D{}'
    contextlist.logger.info(msg.format(port,
                                       index))

    contextlist.duts.append(dut)
    contextlist.dutinformations.append(dut.get_info())
1054012
def wait_until_idle(self):
        

        done = threading.Event()

        def _callback():
            done.set()

        self.defer_until_idle(_callback)
        done.wait()
346410
def start(self):
        
        self._thread = t = threading.Thread(target=self._monitor)
        t.setDaemon(True)
        t.start()
1339968
def background_thread(timeout_fn, timeout_event, handle_exit_code, is_alive,
        quit):
    

    # if there's a timeout event, loop 
    if timeout_event:
        while not quit.is_set():
            timed_out = event_wait(timeout_event, 0.1)
            if timed_out:
                timeout_fn()
                break

    # handle_exit_code will be a function ONLY if our command was NOT waited on
    # as part of its spawning.  in other words, it's probably a background
    # command
    #
    # this reports the exit code exception in our thread.  it's purely for the
    # user's awareness, and cannot be caught or used in any way, so it's ok to
    # suppress this during the tests
    if handle_exit_code and not RUNNING_TESTS: # pragma: no cover
        alive = True
        while alive:
            quit.wait(1)
            alive, exit_code = is_alive()

        handle_exit_code(exit_code)
435341
def run(self):
        
        while True:
            try:
                self._callback(self.wait_read_frame())
            except ThreadQuitException:
                # Expected termintation of thread due to self.halt()
                break
            except Exception as e:
                # Unexpected thread quit.
                if self._error_callback:
                    self._error_callback(e)
1249034
def start(self):
    """"""
    self.__run_backup = self.run
    self.run = self.__run      # Force the Thread to install our trace.
    threading.Thread.start(self)
694883
def interrupt_stdin_thread():
    """"""
    dupped_stdin = os.dup(0)  # Backup the stdin fd
    assert not the_stdin_thread.interrupt_asked  # Sanity check
    the_stdin_thread.interrupt_asked = True  # Not user triggered
    os.lseek(tempfile_fd, 0, 0)  # Rewind in the temp file
    os.dup2(tempfile_fd, 0)  # This will make raw_input() return
    pid = get_stdin_pid()
    os.kill(pid, signal.SIGWINCH)  # Try harder to wake up raw_input()
    the_stdin_thread.out_of_raw_input.wait()  # Wait for this return
    the_stdin_thread.interrupt_asked = False  # Restore sanity
    os.dup2(dupped_stdin, 0)  # Restore stdin
    os.close(dupped_stdin)
266476
def thread_started(self):
		
		while self.check_events() is False:
			self._polling_iteration()
			self.stop_event().wait(self.polling_timeout())
1170869
def start(self):
        
        if not self.robot._primitive_manager.running:
            raise RuntimeError('Cannot run a primitive when the sync is stopped!')

        StoppableThread.start(self)
        self.wait_to_start()

        logger.info("Primitive %s started.", self)
330132
def __start_thread(self):
        
        with self.__lock:
            if self.__nb_threads >= self._max_threads:
                # Can't create more threads
                return False

            if self._done_event.is_set():
                # We're stopped: do nothing
                return False

            # Prepare thread and start it
            name = "{0}-{1}".format(self._logger.name, self._thread_id)
            self._thread_id += 1

            thread = threading.Thread(target=self.__run, name=name)
            thread.daemon = True
            try:
                self.__nb_threads += 1
                thread.start()
                self._threads.append(thread)
                return True
            except (RuntimeError, OSError):
                self.__nb_threads -= 1
                return False