AsyncTaskManager
from panda3d.core import AsyncTaskManager
- class AsyncTaskManager
Bases:
TypedReferenceCount
,Namable
A class to manage a loose queue of isolated tasks, which can be performed either synchronously (in the foreground thread) or asynchronously (by a background thread).
The AsyncTaskManager is actually a collection of AsyncTaskChains, each of which maintains a list of tasks. Each chain can be either foreground or background (it may run only in the main thread, or it may be serviced by one or more background threads). See AsyncTaskChain for more information.
If you do not require background processing, it is perfectly acceptable to create only one AsyncTaskChain, which runs in the main thread. This is a common configuration.
Inheritance diagram
- __init__(*args, **kwargs)
- active_tasks
- add()
C++ Interface: add(const AsyncTaskManager self, AsyncTask task)
- /**
Adds the indicated task to the active queue. It is an error if the task is
already added to this or any other active queue.
*/
- cleanup()
C++ Interface: cleanup(const AsyncTaskManager self)
- /**
Stops all threads and messily empties the task list. This is intended to
be called on destruction only.
*/
- clock
- findTask()
C++ Interface: find_task(AsyncTaskManager self, str name)
- /**
Returns the first task found with the indicated name, or NULL if there is
no task with the indicated name.
If there are multiple tasks with the same name, returns one of them
arbitrarily.
*/
- findTaskChain()
C++ Interface: find_task_chain(const AsyncTaskManager self, str name)
- /**
Searches a new AsyncTaskChain of the indicated name and returns it if it
exists, or NULL otherwise.
*/
- findTasks()
C++ Interface: find_tasks(AsyncTaskManager self, str name)
- /**
Returns the list of tasks found with the indicated name.
*/
- findTasksMatching()
C++ Interface: find_tasks_matching(AsyncTaskManager self, const GlobPattern pattern)
- /**
Returns the list of tasks found whose name matches the indicated glob
pattern, e.g. “my_task_*”.
*/
- find_task()
C++ Interface: find_task(AsyncTaskManager self, str name)
- /**
Returns the first task found with the indicated name, or NULL if there is
no task with the indicated name.
If there are multiple tasks with the same name, returns one of them
arbitrarily.
*/
- find_task_chain()
C++ Interface: find_task_chain(const AsyncTaskManager self, str name)
- /**
Searches a new AsyncTaskChain of the indicated name and returns it if it
exists, or NULL otherwise.
*/
- find_tasks()
C++ Interface: find_tasks(AsyncTaskManager self, str name)
- /**
Returns the list of tasks found with the indicated name.
*/
- find_tasks_matching()
C++ Interface: find_tasks_matching(AsyncTaskManager self, const GlobPattern pattern)
- /**
Returns the list of tasks found whose name matches the indicated glob
pattern, e.g. “my_task_*”.
*/
- getActiveTasks()
C++ Interface: get_active_tasks(AsyncTaskManager self)
- /**
Returns the set of tasks that are active (and not sleeping) on the task
manager, at the time of the call.
*/
- getClassType()
C++ Interface: get_class_type()
- getClock()
C++ Interface: get_clock(const AsyncTaskManager self)
- /**
Returns the clock pointer used within the AsyncTaskManager. See
set_clock().
*/
- getGlobalPtr()
C++ Interface: get_global_ptr()
- /**
Returns a pointer to the global AsyncTaskManager. This is the
AsyncTaskManager that most code should use for queueing tasks and suchlike.
*/
- getNextWakeTime()
C++ Interface: get_next_wake_time(AsyncTaskManager self)
- /**
Returns the scheduled time (on the manager’s clock) of the next sleeping
task, on any task chain, to awaken. Returns -1 if there are no sleeping
tasks.
*/
- getNumTaskChains()
C++ Interface: get_num_task_chains(AsyncTaskManager self)
- /**
Returns the number of different task chains.
*/
- getNumTasks()
C++ Interface: get_num_tasks(AsyncTaskManager self)
- /**
Returns the number of tasks that are currently active or sleeping within
the task manager.
*/
- getSleepingTasks()
C++ Interface: get_sleeping_tasks(AsyncTaskManager self)
- /**
Returns the set of tasks that are sleeping (and not active) on the task
manager, at the time of the call.
*/
- getTaskChain()
C++ Interface: get_task_chain(AsyncTaskManager self, int n)
- /**
Returns the nth task chain.
*/
- getTaskChains()
- getTasks()
C++ Interface: get_tasks(AsyncTaskManager self)
- /**
Returns the set of tasks that are active or sleeping on the task manager,
at the time of the call.
*/
- get_active_tasks()
C++ Interface: get_active_tasks(AsyncTaskManager self)
- /**
Returns the set of tasks that are active (and not sleeping) on the task
manager, at the time of the call.
*/
- get_class_type()
C++ Interface: get_class_type()
- get_clock()
C++ Interface: get_clock(const AsyncTaskManager self)
- /**
Returns the clock pointer used within the AsyncTaskManager. See
set_clock().
*/
- get_global_ptr()
C++ Interface: get_global_ptr()
- /**
Returns a pointer to the global AsyncTaskManager. This is the
AsyncTaskManager that most code should use for queueing tasks and suchlike.
*/
- get_next_wake_time()
C++ Interface: get_next_wake_time(AsyncTaskManager self)
- /**
Returns the scheduled time (on the manager’s clock) of the next sleeping
task, on any task chain, to awaken. Returns -1 if there are no sleeping
tasks.
*/
- get_num_task_chains()
C++ Interface: get_num_task_chains(AsyncTaskManager self)
- /**
Returns the number of different task chains.
*/
- get_num_tasks()
C++ Interface: get_num_tasks(AsyncTaskManager self)
- /**
Returns the number of tasks that are currently active or sleeping within
the task manager.
*/
- get_sleeping_tasks()
C++ Interface: get_sleeping_tasks(AsyncTaskManager self)
- /**
Returns the set of tasks that are sleeping (and not active) on the task
manager, at the time of the call.
*/
- get_task_chain()
C++ Interface: get_task_chain(AsyncTaskManager self, int n)
- /**
Returns the nth task chain.
*/
- get_task_chains()
- get_tasks()
C++ Interface: get_tasks(AsyncTaskManager self)
- /**
Returns the set of tasks that are active or sleeping on the task manager,
at the time of the call.
*/
- hasTask()
C++ Interface: has_task(AsyncTaskManager self, AsyncTask task)
- /**
Returns true if the indicated task has been added to this AsyncTaskManager,
false otherwise.
*/
- has_task()
C++ Interface: has_task(AsyncTaskManager self, AsyncTask task)
- /**
Returns true if the indicated task has been added to this AsyncTaskManager,
false otherwise.
*/
- makeTaskChain()
C++ Interface: make_task_chain(const AsyncTaskManager self, str name) make_task_chain(const AsyncTaskManager self, str name, int num_threads, int thread_priority)
- /**
Creates a new AsyncTaskChain of the indicated name and stores it within the
AsyncTaskManager. If a task chain with this name already exists, returns
it instead.
*/
- /**
Creates a new threaded AsyncTaskChain of the indicated name and stores it
within the AsyncTaskManager. If a task chain with this name already exists,
returns it instead.
*/
- make_task_chain()
C++ Interface: make_task_chain(const AsyncTaskManager self, str name) make_task_chain(const AsyncTaskManager self, str name, int num_threads, int thread_priority)
- /**
Creates a new AsyncTaskChain of the indicated name and stores it within the
AsyncTaskManager. If a task chain with this name already exists, returns
it instead.
*/
- /**
Creates a new threaded AsyncTaskChain of the indicated name and stores it
within the AsyncTaskManager. If a task chain with this name already exists,
returns it instead.
*/
- next_wake_time
- poll()
C++ Interface: poll(const AsyncTaskManager self)
- /**
Runs through all the tasks in the task list, once, if the task manager is
running in single-threaded mode (no threads available). This method does
nothing in threaded mode, so it may safely be called in either case.
*/
- remove()
C++ Interface: remove(const AsyncTaskManager self, AsyncTask task) remove(const AsyncTaskManager self, const AsyncTaskCollection tasks)
- removeTaskChain()
C++ Interface: remove_task_chain(const AsyncTaskManager self, str name)
- /**
Removes the AsyncTaskChain of the indicated name. If the chain still has
tasks, this will block until all tasks are finished.
Returns true if successful, or false if the chain did not exist.
*/
- remove_task_chain()
C++ Interface: remove_task_chain(const AsyncTaskManager self, str name)
- /**
Removes the AsyncTaskChain of the indicated name. If the chain still has
tasks, this will block until all tasks are finished.
Returns true if successful, or false if the chain did not exist.
*/
- setClock()
C++ Interface: set_clock(const AsyncTaskManager self, ClockObject clock)
- /**
Replaces the clock pointer used within the AsyncTaskManager. This is used
to control when tasks with a set_delay() specified will be scheduled. It
can also be ticked automatically each epoch, if set_tick_clock() is true.
The default is the global clock pointer.
*/
- set_clock()
C++ Interface: set_clock(const AsyncTaskManager self, ClockObject clock)
- /**
Replaces the clock pointer used within the AsyncTaskManager. This is used
to control when tasks with a set_delay() specified will be scheduled. It
can also be ticked automatically each epoch, if set_tick_clock() is true.
The default is the global clock pointer.
*/
- sleeping_tasks
- startThreads()
C++ Interface: start_threads(const AsyncTaskManager self)
- /**
Starts any requested threads to service the tasks on the queue. This is
normally not necessary, since adding a task will start the threads
automatically.
*/
- start_threads()
C++ Interface: start_threads(const AsyncTaskManager self)
- /**
Starts any requested threads to service the tasks on the queue. This is
normally not necessary, since adding a task will start the threads
automatically.
*/
- stopThreads()
C++ Interface: stop_threads(const AsyncTaskManager self)
- /**
Stops any threads that are currently running. If any tasks are still
pending and have not yet been picked up by a thread, they will not be
serviced unless poll() or start_threads() is later called.
*/
- stop_threads()
C++ Interface: stop_threads(const AsyncTaskManager self)
- /**
Stops any threads that are currently running. If any tasks are still
pending and have not yet been picked up by a thread, they will not be
serviced unless poll() or start_threads() is later called.
*/
- tasks
- upcastToNamable()
C++ Interface: upcast_to_Namable(const AsyncTaskManager self)
upcast from AsyncTaskManager to Namable
- upcastToTypedReferenceCount()
C++ Interface: upcast_to_TypedReferenceCount(const AsyncTaskManager self)
upcast from AsyncTaskManager to TypedReferenceCount
- upcast_to_Namable()
C++ Interface: upcast_to_Namable(const AsyncTaskManager self)
upcast from AsyncTaskManager to Namable
- upcast_to_TypedReferenceCount()
C++ Interface: upcast_to_TypedReferenceCount(const AsyncTaskManager self)
upcast from AsyncTaskManager to TypedReferenceCount
- waitForTasks()
C++ Interface: wait_for_tasks(const AsyncTaskManager self)
- /**
Blocks until the task list is empty.
*/