Wrap the start function from thread. Put the tracer informations in the
    threading object.
489977
def wrap_threading_start(start_func):
    

    def call(self):
        self._opencensus_context = (
            execution_context.get_opencensus_full_context()
        )
        return start_func(self)

    return call
288913
def trace_integration(tracer=None):
    """"""
    log.info("Integrated module: {}".format(MODULE_NAME))
    # Wrap the threading start function
    start_func = getattr(threading.Thread, "start")
    setattr(
        threading.Thread, start_func.__name__, wrap_threading_start(start_func)
    )

    # Wrap the threading run function
    run_func = getattr(threading.Thread, "run")
    setattr(threading.Thread, run_func.__name__, wrap_threading_run(run_func))

    # Wrap the threading run function
    apply_async_func = getattr(pool.Pool, "apply_async")
    setattr(
        pool.Pool,
        apply_async_func.__name__,
        wrap_apply_async(apply_async_func),
    )

    # Wrap the threading run function
    submit_func = getattr(futures.ThreadPoolExecutor, "submit")
    setattr(
        futures.ThreadPoolExecutor,
        submit_func.__name__,
        wrap_submit(submit_func),
    )
943924
def init_threads(t=None, s=None):
    """"""
    global THREAD, SIGNAL
    THREAD = t or dummyThread
    SIGNAL = s or dummySignal
302433
def start(self):
        """"""
        assert self._thread is None, 'thread already started'

        # configure thread
        self._thread = Thread(target=self._start_io_loop)
        self._thread.daemon = True

        # begin thread and block until ready
        self._thread.start()
        self._ready.wait()
181808
def threader(group=None, name=None, daemon=True):
    
    def decorator(job):
        """
        :param job: function to be threaded
        :rtype: wrap
        """
        def wrapped_job(queue, *args, **kwargs):
            """ this function calls the decorated function
            and puts the result in a queue
            :type queue: Queue
            """
            ret = job(*args, **kwargs)
            queue.put(ret)

        def wrap(*args, **kwargs):
            """ this is the function returned from the decorator. It fires off
            wrapped_f in a new thread and returns the thread object with
            the result queue attached
            :rtype: Thread
            """
            thread = Thread(group=group, target=wrapped_job, name=name, args=args, kwargs=kwargs, daemon=daemon)
            thread.start()
            return thread
        return wrap
    return decorator
770129
def run_on_new_thread(func, daemon=True):
    
    f = concurrent.futures.Future()
    def wrapper():
        if not f.set_running_or_notify_cancel():
            return
        try:
            f.set_result(func())
        except Exception as e:
            f.set_exception(e)
    t = threading.Thread(target=wrapper)
    t.daemon = daemon
    t.start()
    return f
904309
def _thread_init(cls):
    """"""
    if not hasattr(cls._local, '_in_order_futures'):
      cls._local._in_order_futures = set()
      cls._local._activated = False
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)
328478
def Start(self):
    """"""
    if not self.started:
      self.started = True
      for _ in range(self.min_threads):
        self._AddWorker()
231574
def start(self, threaded=True):
        
        self.running = True
        if threaded:
            self._thread = Thread(target=self._run)
            self._thread.start()
        else:
            self._run()
5212
def wrap_submit(submit_func):
    """"""

    def call(self, func, *args, **kwargs):
        wrapped_func = wrap_task_func(func)
        _tracer = execution_context.get_opencensus_tracer()
        propagator = binary_format.BinaryFormatPropagator()

        wrapped_kwargs = {}
        wrapped_kwargs["span_context_binary"] = propagator.to_header(
            _tracer.span_context
        )
        wrapped_kwargs["kwds"] = kwargs
        wrapped_kwargs["sampler"] = _tracer.sampler
        wrapped_kwargs["exporter"] = _tracer.exporter
        wrapped_kwargs["propagator"] = _tracer.propagator

        return submit_func(self, wrapped_func, *args, **wrapped_kwargs)

    return call
921281
def start(self):
		

		start_event = self.start_event()
		stop_event = self.stop_event()
		ready_event = self.ready_event()

		def thread_target():
			try:
				start_event.set()
				self.thread_started()
				if ready_event is not None:
					ready_event.set()
			except Exception as e:
				self.exception_event().set()
				self.thread_exception(e)

		if self.__thread is None:
			if stop_event is not None:
				stop_event.clear()

			if ready_event is not None:
				ready_event.clear()

			self.exception_event().clear()

			self.__thread = Thread(target=thread_target, name=self.thread_name())
			self.__thread.start()
1328935
def _start_tracer(self, origin):
        
        tracer = self._tracer_class(log=self.log)
        tracer.data = self.data
        fn = tracer.start(origin)
        self.tracers.append(tracer)
        return fn
443472
def during(f):
    """"""
    def decorator(g):
        @wraps(g)
        def h(*args, **kargs):
            tf = Thread(target=f, args=args, kwargs=kargs)
            tf.start()
            r = g(*args, **kargs)
            tf.join()
            return r
        return h
    return decorator
447349
def start(self):
        
        self.thread_handler.run(target=self.start_blocking)
        self.thread_handler.start_run_loop()
436748
def start(self):
        
        self.running = True
        self.thread = threading.Thread(target=self._main_loop)
        self.thread.start()
346410
def start(self):
        
        self._thread = t = threading.Thread(target=self._monitor)
        t.setDaemon(True)
        t.start()