WaitQueue Class Reference

This class is a useful wrapper for timer events to be used in schedulers. More...

#include <waitqueue.h>

List of all members.

Public Member Functions

bool isempty () const
 Checks whether the queue is empty.
Timeval delay () const
 Returns how long to wait before next Callback is to be run.
Timeval delay (const timeval &now) const
 Returns how long to wait before next Callback is to be run.
void put (Callback &callback, const timeval &tv)
 Puts a new Callback that is to be run at a given (absolute) time in the queue.
Callbackget ()
 Gets a Callback that is to be run now from the WaitQueue.
Callbackget (const timeval &now)
 Gets a Callback that is to be run now from the WaitQueue.
bool cleanup ()
 Removes completed callbacks from WaitQueue.

Classes

class  Waiter
class  WaiterComparator


Detailed Description

This class is a useful wrapper for timer events to be used in schedulers.


Member Function Documentation

bool WaitQueue::isempty (  )  const

Checks whether the queue is empty.

This may be run to find out whether delay() may be run.

Returns:
true if the queue is empty
See also:
delay

Timeval WaitQueue::delay (  )  const

Returns how long to wait before next Callback is to be run.

This must not be called on an empty WaitQueue.

Returns:
a Timeval containing the time to wait

Timeval WaitQueue::delay ( const timeval &  now  )  const

Returns how long to wait before next Callback is to be run.

This must not be called on an empty WaitQueue.

Parameters:
now specifies the current time
Returns:
a Timeval containing the time to wait

void WaitQueue::put ( Callback callback,
const timeval &  tv 
)

Puts a new Callback that is to be run at a given (absolute) time in the queue.

Parameters:
callback is to be run at tv
tv is the absolute time for running callback

Callback * WaitQueue::get (  ) 

Gets a Callback that is to be run now from the WaitQueue.

Returns:
a Callback pointer if there are callbacks to be run and NULL if the queue is empty or none is to be run

Callback * WaitQueue::get ( const timeval &  now  ) 

Gets a Callback that is to be run now from the WaitQueue.

Parameters:
now specifies the current time
Returns:
a Callback pointer if there are callbacks to be run and NULL if the queue is empty or none is to be run

bool WaitQueue::cleanup (  ) 

Removes completed callbacks from WaitQueue.

Returns the same as !isempty(), i.e. did the cleanup leave elements?.

Returns:
!isempty()
See also:
isempty


The documentation for this class was generated from the following files:
Generated on Sat Feb 7 01:26:51 2009 by  doxygen 1.5.1