coro_thread_func¶
-
privex.helpers.asyncx.coro_thread_func(func: callable, *t_args, _output_queue: Optional[Union[queue.Queue, str]] = None, **t_kwargs)[source]¶ This function is not intended to be called directly. It’s designed to be used as the target of a
threading.Thread.Runs the coroutine function
funcusing a new event loop for the thread this function is running within, and relays the result or an exception (if one was raised) via thequeue.Queue_output_queueSee the higher level
run_coro_thread()for more info.- Parameters
func (callable) – A reference to the
async defcoroutine function that you want to runt_args – Positional arguments to pass-through to the coroutine function
_output_queue –
(default:
None) Thequeue.Queueto emit the result or raised exception through. This can also be set toNoneto disable transmitting the result/exception via a queue.This can also be set to the string
"default", which means the result/exception will be transmitted via theasyncxprivate queue_coro_thread_queuet_kwargs – Keyword arguments to pass-through to the coroutine function