mode.threads
¶
ServiceThread - Service that starts in a separate thread.
Will use the default thread pool executor (loop.set_default_executor()
),
unless you specify a specific executor instance.
Note: To stop something using the thread’s loop, you have to
use the on_thread_stop
callback instead of the on_stop callback.
-
class
mode.threads.
QueuedMethod
[source]¶ Describe a method to be called by thread.
-
property
promise
¶ Alias for field number 0
-
property
method
¶ Alias for field number 1
-
property
args
¶ Alias for field number 2
-
property
kwargs
¶ Alias for field number 3
-
property
-
class
mode.threads.
WorkerThread
(service: mode.threads.ServiceThread, **kwargs: Any)[source]¶ Thread class used for services running in a dedicated thread.
-
run
() → None[source]¶ Method representing the thread’s activity.
You may override this method in a subclass. The standard run() method invokes the callable object passed to the object’s constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively.
-
-
class
mode.threads.
ServiceThread
(*, executor: Any = None, loop: asyncio.events.AbstractEventLoop = None, thread_loop: asyncio.events.AbstractEventLoop = None, Worker: Type[mode.threads.WorkerThread] = None, **kwargs: Any)[source]¶ Service subclass running within a dedicated thread.
-
abstract
= False¶
-
wait_for_shutdown
= True¶
-
wait_for_thread
= True¶ Set this to False if s.start() should not wait for the underlying thread to be fully started.
-
Worker
¶ alias of
WorkerThread
-
logger
= <Logger mode.threads (WARNING)>¶
-
-
class
mode.threads.
QueueServiceThread
(*, executor: Any = None, loop: asyncio.events.AbstractEventLoop = None, thread_loop: asyncio.events.AbstractEventLoop = None, Worker: Type[mode.threads.WorkerThread] = None, **kwargs: Any)[source]¶ Service running in separate thread.
Uses a queue to run functions inside the thread, so you can delegate calls.
-
logger
= <Logger mode.threads (WARNING)>¶
-
abstract
= False¶
-
property
method_queue
¶
-