TaskPool#
Superclasses: Object
, InitiallyUnowned
, Object
Subclasses: SharedTaskPool
This object provides an abstraction for creating threads. The default implementation uses a regular GThreadPool to start tasks.
Subclasses can be made to create custom threads.
Constructors#
Methods#
- class TaskPool
- cleanup() None #
Wait for all tasks to be stopped. This is mainly used internally to ensure proper cleanup of internal data structures in test suites.
MT safe.
- dispose_handle(id: Any = None) None #
Dispose of the handle returned by
push()
. This does not need to be called with the default implementation as the defaultTaskPoolClass
::push implementation always returnsNone
. This does not need to be called either when callingjoin()
, but should be called when joining is not necessary, butpush()
returned a non-None
value.This method should only be called with the same
pool
instance that providedid
.Added in version 1.20.
- Parameters:
id – the id
- do_push(self, func: Callable[[Any], None], user_data: Any = None) Any | None #
- Parameters:
func
user_data
- join(id: Any = None) None #
Join a task and/or return it to the pool.
id
is the id obtained frompush()
. The default implementation does nothing, as the defaultTaskPoolClass
::push implementation always returnsNone
.This method should only be called with the same
pool
instance that providedid
.- Parameters:
id – the id
Virtual Methods#
- class TaskPool
- do_cleanup() None #
Wait for all tasks to be stopped. This is mainly used internally to ensure proper cleanup of internal data structures in test suites.
MT safe.
- do_dispose_handle(id: Any = None) None #
Dispose of the handle returned by
push()
. This does not need to be called with the default implementation as the defaultTaskPoolClass
::push implementation always returnsNone
. This does not need to be called either when callingjoin()
, but should be called when joining is not necessary, butpush()
returned a non-None
value.This method should only be called with the same
pool
instance that providedid
.Added in version 1.20.
- Parameters:
id – the id
- do_join(id: Any = None) None #
Join a task and/or return it to the pool.
id
is the id obtained frompush()
. The default implementation does nothing, as the defaultTaskPoolClass
::push implementation always returnsNone
.This method should only be called with the same
pool
instance that providedid
.- Parameters:
id – the id