Panda3D
 All Classes Functions Variables Enumerations
asyncTaskChain.I
00001 // Filename: asyncTaskChain.I
00002 // Created by:  drose (23Aug06)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 
00016 ////////////////////////////////////////////////////////////////////
00017 //     Function: AsyncTaskChain::is_started
00018 //       Access: Published
00019 //  Description: Returns true if the thread(s) have been started and
00020 //               are ready to service requests, false otherwise.  If
00021 //               this is false, the next call to add() or add_and_do()
00022 //               will automatically start the threads.
00023 ////////////////////////////////////////////////////////////////////
00024 INLINE bool AsyncTaskChain::
00025 is_started() const {
00026   return (_state == S_started);
00027 }
00028 
00029 ////////////////////////////////////////////////////////////////////
00030 //     Function: AsyncTaskChain::do_get_next_wake_time
00031 //       Access: Protected
00032 //  Description: Returns the time at which the next sleeping thread
00033 //               will awaken, or -1 if there are no sleeping threads.
00034 //               Assumes the lock is already held.
00035 ////////////////////////////////////////////////////////////////////
00036 INLINE double AsyncTaskChain::
00037 do_get_next_wake_time() const {
00038   if (!_sleeping.empty()) {
00039     return _sleeping.front()->_wake_time;
00040   }
00041   return -1.0;
00042 }
00043 
00044 ////////////////////////////////////////////////////////////////////
00045 //     Function: AsyncTaskChain::get_wake_time
00046 //       Access: Protected, Static
00047 //  Description: Returns the time at which the indicated thread
00048 //               will awaken. Assumes the lock is already held.
00049 ////////////////////////////////////////////////////////////////////
00050 INLINE double AsyncTaskChain::
00051 get_wake_time(AsyncTask *task) {
00052   return task->_wake_time;
00053 }
 All Classes Functions Variables Enumerations