is_alive()

This commit is contained in:
David Rose 2008-10-22 19:12:33 +00:00
parent 5b0c9c395f
commit 8e68eb1dcd
2 changed files with 26 additions and 0 deletions

View File

@ -23,6 +23,31 @@ get_state() const {
return _state;
}
////////////////////////////////////////////////////////////////////
// Function: AsyncTask::is_alive
// Access: Published
// Description: Returns true if the task is currently active or
// sleeping on some task chain, meaning that it will be
// executed in its turn, or false if it is not active.
// If the task has recently been removed while it is in
// the middle of execution, this will return false,
// because the task will not run again once it finishes.
////////////////////////////////////////////////////////////////////
INLINE bool AsyncTask::
is_alive() const {
switch (_state) {
case S_active:
case S_servicing:
case S_sleeping:
case S_active_nested:
return true;
case S_inactive:
case S_servicing_removed:
return false;
}
}
////////////////////////////////////////////////////////////////////
// Function: AsyncTask::get_manager
// Access: Published

View File

@ -69,6 +69,7 @@ PUBLISHED:
};
INLINE State get_state() const;
INLINE bool is_alive() const;
INLINE AsyncTaskManager *get_manager() const;
void remove();