HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_ThreadQueue< T > Class Template Reference

#include <UT_ThreadQueue.h>

Public Member Functions

 UT_ThreadQueue (exint maxcost=-1)
 A max cost of -1 will never block on adding items to the queue. More...
 
 ~UT_ThreadQueue ()
 
int entries () const
 Synchronized test for number of entries. More...
 
bool remove (T &item)
 
T waitAndRemove ()
 Blocks until the item is ready. More...
 
void waitForEmpty ()
 
int waitForQueueChange ()
 
void append (const T &item, exint cost=0)
 

Protected Member Functions

bool isEmpty () const
 Non-synchronized, do not call outside of the lock. More...
 

Detailed Description

template<typename T>
class UT_ThreadQueue< T >

UT_ThreadQueue

Designed to be templated on a POD.

Definition at line 27 of file UT_ThreadQueue.h.

Constructor & Destructor Documentation

template<typename T>
UT_ThreadQueue< T >::UT_ThreadQueue ( exint  maxcost = -1)
inline

A max cost of -1 will never block on adding items to the queue.

Definition at line 31 of file UT_ThreadQueue.h.

template<typename T>
UT_ThreadQueue< T >::~UT_ThreadQueue ( )
inline

Definition at line 36 of file UT_ThreadQueue.h.

Member Function Documentation

template<typename T>
void UT_ThreadQueue< T >::append ( const T item,
exint  cost = 0 
)
inline

Adds the item to the queue. Will block if it the total cost would be exceeded by adding this to the queue. Zero cost never block, nor does a max cost of -1

Definition at line 106 of file UT_ThreadQueue.h.

template<typename T>
int UT_ThreadQueue< T >::entries ( void  ) const
inline

Synchronized test for number of entries.

Definition at line 39 of file UT_ThreadQueue.h.

template<typename T>
bool UT_ThreadQueue< T >::isEmpty ( ) const
inlineprotected

Non-synchronized, do not call outside of the lock.

Definition at line 137 of file UT_ThreadQueue.h.

template<typename T>
bool UT_ThreadQueue< T >::remove ( T item)
inline

Removes an item, returns false if failed to remove because the queue was empty.

Definition at line 48 of file UT_ThreadQueue.h.

template<typename T>
T UT_ThreadQueue< T >::waitAndRemove ( )
inline

Blocks until the item is ready.

Definition at line 64 of file UT_ThreadQueue.h.

template<typename T>
void UT_ThreadQueue< T >::waitForEmpty ( )
inline

Blocks until the queue is empty. May not still be empty, since someone could add after you reach empty!

Definition at line 79 of file UT_ThreadQueue.h.

template<typename T>
int UT_ThreadQueue< T >::waitForQueueChange ( )
inline

Blocks until a queue change occurs, returns the new queue size. Returns zero immediately if queue is empty.

Definition at line 91 of file UT_ThreadQueue.h.


The documentation for this class was generated from the following file: