Panda3D
 All Classes Functions Variables Enumerations
asyncTaskChain.I
1 // Filename: asyncTaskChain.I
2 // Created by: drose (23Aug06)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 
16 ////////////////////////////////////////////////////////////////////
17 // Function: AsyncTaskChain::is_started
18 // Access: Published
19 // Description: Returns true if the thread(s) have been started and
20 // are ready to service requests, false otherwise. If
21 // this is false, the next call to add() or add_and_do()
22 // will automatically start the threads.
23 ////////////////////////////////////////////////////////////////////
24 INLINE bool AsyncTaskChain::
25 is_started() const {
26  return (_state == S_started);
27 }
28 
29 ////////////////////////////////////////////////////////////////////
30 // Function: AsyncTaskChain::do_get_next_wake_time
31 // Access: Protected
32 // Description: Returns the time at which the next sleeping thread
33 // will awaken, or -1 if there are no sleeping threads.
34 // Assumes the lock is already held.
35 ////////////////////////////////////////////////////////////////////
36 INLINE double AsyncTaskChain::
37 do_get_next_wake_time() const {
38  if (!_sleeping.empty()) {
39  return _sleeping.front()->_wake_time;
40  }
41  return -1.0;
42 }
43 
44 ////////////////////////////////////////////////////////////////////
45 // Function: AsyncTaskChain::get_wake_time
46 // Access: Protected, Static
47 // Description: Returns the time at which the indicated thread
48 // will awaken. Assumes the lock is already held.
49 ////////////////////////////////////////////////////////////////////
50 INLINE double AsyncTaskChain::
51 get_wake_time(AsyncTask *task) {
52  return task->_wake_time;
53 }
bool is_started() const
Returns true if the thread(s) have been started and are ready to service requests, false otherwise.
This class represents a concrete task performed by an AsyncManager.
Definition: asyncTask.h:43