AsyncTaskManager

Inheritance:

Methods of AsyncTaskManager:

Methods of TypedReferenceCount:

Methods of TypedObject:

Methods of ReferenceCount:

Methods of Namable:

AsyncTaskManager
AsyncTaskManager::AsyncTaskManager(string const &name);

Description:

add
void AsyncTaskManager::add(AsyncTask *task);

Description: 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
void AsyncTaskManager::cleanup(void);

Description: Stops all threads and messily empties the task list. This is intended to be called on destruction only.

findTask
AsyncTask *AsyncTaskManager::find_task(string const &name) const;

Description: 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
AsyncTaskChain *AsyncTaskManager::find_task_chain(string const &name);

Description: Searches a new AsyncTaskChain of the indicated name and returns it if it exists, or NULL otherwise.

findTasks
AsyncTaskCollection AsyncTaskManager::find_tasks(string const &name) const;

Description: Returns the list of tasks found with the indicated name.

findTasksMatching
AsyncTaskCollection AsyncTaskManager::find_tasks_matching(GlobPattern const &pattern) const;

Description: Returns the list of tasks found whose name matches the indicated glob pattern, e.g. "my_task_*".

getActiveTasks
AsyncTaskCollection AsyncTaskManager::get_active_tasks(void) const;

Description: Returns the set of tasks that are active (and not sleeping) on the task manager, at the time of the call.

getClassType
static TypeHandle AsyncTaskManager::get_class_type(void);

Undocumented function.

getClock
ClockObject *AsyncTaskManager::get_clock(void);

Description: Returns the clock pointer used within the AsyncTaskManager. See set_clock().

getGlobalPtr
static AsyncTaskManager *AsyncTaskManager::get_global_ptr(void);

Description: Returns a pointer to the global AsyncTaskManager. This is the AsyncTaskManager that most code should use for queueing tasks and suchlike.

getNextWakeTime
double AsyncTaskManager::get_next_wake_time(void) const;

Description: 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
int AsyncTaskManager::get_num_task_chains(void) const;

Description: Returns the number of different task chains.

getNumTasks
int AsyncTaskManager::get_num_tasks(void) const;

Description: Returns the number of tasks that are currently active or sleeping within the task manager.

getSleepingTasks
AsyncTaskCollection AsyncTaskManager::get_sleeping_tasks(void) const;

Description: Returns the set of tasks that are sleeping (and not active) on the task manager, at the time of the call.

getTaskChain
AsyncTaskChain *AsyncTaskManager::get_task_chain(int n) const;

Description: Returns the nth task chain.

getTasks
AsyncTaskCollection AsyncTaskManager::get_tasks(void) const;

Description: Returns the set of tasks that are active or sleeping on the task manager, at the time of the call.

hasTask
bool AsyncTaskManager::has_task(AsyncTask *task) const;

Description: Returns true if the indicated task has been added to this AsyncTaskManager, false otherwise.

makeTaskChain
AsyncTaskChain *AsyncTaskManager::make_task_chain(string const &name);

Description: 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.

output
virtual void AsyncTaskManager::output(ostream &out) const;

Description:

poll
void AsyncTaskManager::poll(void);

Description: 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
bool AsyncTaskManager::remove(AsyncTask *task);

Description: Removes the indicated task from the active queue. Returns true if the task is successfully removed, or false if it wasn't there.
Description: Removes all of the tasks in the AsyncTaskCollection. Returns the number of tasks removed.

removeTaskChain
bool AsyncTaskManager::remove_task_chain(string const &name);

Description: 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
void AsyncTaskManager::set_clock(ClockObject *clock);

Description: 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.

startThreads
void AsyncTaskManager::start_threads(void);

Description: 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
void AsyncTaskManager::stop_threads(void);

Description: 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.

waitForTasks
void AsyncTaskManager::wait_for_tasks(void);

Description: Blocks until the task list is empty.

write
virtual void AsyncTaskManager::write(ostream &out, int indent_level = (0)) const;

Description:

getClassType
static TypeHandle TypedReferenceCount::get_class_type(void);

Undocumented function.

getClassType
static TypeHandle TypedObject::get_class_type(void);

Undocumented function.

getType
virtual TypeHandle TypedObject::get_type(void) const = 0;

Derived classes should override this function to return get_class_type().

getTypeIndex
int TypedObject::get_type_index(void) const;

Description: Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. This is equivalent to get_type().get_index().

isExactType
bool TypedObject::is_exact_type(TypeHandle handle) const;

Description: Returns true if the current object is the indicated type exactly.

isOfType
bool TypedObject::is_of_type(TypeHandle handle) const;

Description: Returns true if the current object is or derives from the indicated type.

getClassType
static TypeHandle ReferenceCount::get_class_type(void);

Undocumented function.

getRefCount
int ReferenceCount::get_ref_count(void) const;

Description: Returns the current reference count.

ref
void ReferenceCount::ref(void) const;

Description: Explicitly increments the reference count. User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically.
This function is const, even though it changes the object, because generally fiddling with an object's reference count isn't considered part of fiddling with the object. An object might be const in other ways, but we still need to accurately count the number of references to it.

testRefCountIntegrity
bool ReferenceCount::test_ref_count_integrity(void) const;

Description: Does some easy checks to make sure that the reference count isn't completely bogus. Returns true if ok, false otherwise.

testRefCountNonzero
bool ReferenceCount::test_ref_count_nonzero(void) const;

Description: Does some easy checks to make sure that the reference count isn't zero, or completely bogus. Returns true if ok, false otherwise.

unref
bool ReferenceCount::unref(void) const;

Description: Explicitly decrements the reference count. Note that the object will not be implicitly deleted by unref() simply because the reference count drops to zero. (Having a member function delete itself is problematic; plus, we don't have a virtual destructor anyway.) However, see the helper function unref_delete().
User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically.
This function is const, even though it changes the object, because generally fiddling with an object's reference count isn't considered part of fiddling with the object. An object might be const in other ways, but we still need to accurately count the number of references to it.
The return value is true if the new reference count is nonzero, false if it is zero.

Namable
Namable::Namable(string const &initial_name = (""));

Description:

clearName
void Namable::clear_name(void);

Description: Resets the Namable's name to empty.

getClassType
static TypeHandle Namable::get_class_type(void);

Undocumented function.

getName
string const &Namable::get_name(void) const;

Description:

hasName
bool Namable::has_name(void) const;

Description: Returns true if the Namable has a nonempty name set, false if the name is empty.

operator =
Namable &Namable::operator =(Namable const &other);

Description:

output
void Namable::output(ostream &out) const;

In the absence of any definition to the contrary, outputting a Namable will write out its name.
Description: Outputs the Namable. This function simply writes the name to the output stream; most Namable derivatives will probably redefine this.

setName
void Namable::set_name(string const &name);

Description: