code: async def start_component_in_thread(executor, workload: CoroutineFunction[T], *args: Any, loop=None, **kwargs: Any) -> Component[T]:
      
  
      loop = loop or asyncio.get_event_loop()
  
      commands_a, commands_b = pipe(loop=loop)
      events_a, events_b = pipe(loop=loop)
  
      commands_b = ConcurrentPipeEnd(commands_b, loop=loop)
      events_b = ConcurrentPipeEnd(events_b, loop=loop)
  
      _workload = workload(*args, commands=commands_b, events=events_b, **kwargs)
      future = cast(_Future[T], loop.run_in_executor(executor, asyncio.run, _workload))
  
      component = Component[T](commands_a, events_a, future)
      await component.wait_for_start()
      return component
docs: \
      Starts the passed `workload` with additional `commands` and `events` pipes.
      The workload will be executed on an event loop in a new thread; the thread is provided by `executor`.
  
      This function is not compatible with `ProcessPoolExecutor`,
      as references between the workload and component are necessary.
  
      Be careful when using an executor with a maximum number of threads,
      as long running workloads may starve other tasks.
      Consider using a dedicated executor that can spawn at least as many threads
      as concurrent long-running tasks are expected.