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
 Prohibit copying as I am not sure if lock semantics will work. 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)
 
void append (T &&item, exint cost=0)
 

Detailed Description

template<typename T>
class UT_ThreadQueue< T >

UT_ThreadQueue

Designed to be templated on a POD.

Definition at line 29 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 33 of file UT_ThreadQueue.h.

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

Definition at line 38 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 112 of file UT_ThreadQueue.h.

template<typename T>
void UT_ThreadQueue< T >::append ( 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 114 of file UT_ThreadQueue.h.

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

Prohibit copying as I am not sure if lock semantics will work.

Synchronized test for number of entries

Definition at line 44 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 53 of file UT_ThreadQueue.h.

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

Blocks until the item is ready.

Definition at line 69 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 84 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 96 of file UT_ThreadQueue.h.


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