Parolin 0.7.9 6796
Console (soon DLLs) to do a tar like job
Loading...
Searching...
No Matches
WorkQueue< T > Class Template Reference

Unbounded thread-safe work queue. More...

#include <WorkQueue.h>

Public Member Functions

 WorkQueue (std::size_t maxSize=0)
 
bool push (T &&item)
 
bool pop (T &item)
 
void setMaxSize (std::size_t maxSize)
 
void finish ()
 
void waitUntilFinished ()
 Blocks until finish() has been called (but the queue may not be empty).
 
 WorkQueue (std::size_t maxSize=0)
 
bool push (T &&item)
 
bool pop (T &item)
 
void setMaxSize (std::size_t maxSize)
 
void finish ()
 
void waitUntilFinished ()
 Blocks until finish() has been called (but the queue may not be empty).
 
 WorkQueue (std::size_t maxSize=0)
 
bool push (T &&item)
 
bool pop (T &item)
 
void setMaxSize (std::size_t maxSize)
 
void finish ()
 
void waitUntilFinished ()
 Blocks until finish() has been called (but the queue may not be empty).
 

Detailed Description

template<typename T>
class pzstd::WorkQueue< T >

Unbounded thread-safe work queue.

Constructor & Destructor Documentation

◆ WorkQueue() [1/3]

template<typename T >
WorkQueue ( std::size_t maxSize = 0)
inline

Constructs an empty work queue with an optional max size. If maxSize == 0 the queue size is unbounded.

Parameters
maxSizeThe maximum allowed size of the work queue.

◆ WorkQueue() [2/3]

template<typename T >
WorkQueue ( std::size_t maxSize = 0)
inline

Constructs an empty work queue with an optional max size. If maxSize == 0 the queue size is unbounded.

Parameters
maxSizeThe maximum allowed size of the work queue.

◆ WorkQueue() [3/3]

template<typename T >
WorkQueue ( std::size_t maxSize = 0)
inline

Constructs an empty work queue with an optional max size. If maxSize == 0 the queue size is unbounded.

Parameters
maxSizeThe maximum allowed size of the work queue.

Member Function Documentation

◆ finish() [1/3]

template<typename T >
void finish ( )
inline

Promise that push() won't be called again, so once the queue is empty there will never any more work.

◆ finish() [2/3]

template<typename T >
void finish ( )
inline

Promise that push() won't be called again, so once the queue is empty there will never any more work.

◆ finish() [3/3]

template<typename T >
void finish ( )
inline

Promise that push() won't be called again, so once the queue is empty there will never any more work.

◆ pop() [1/3]

template<typename T >
bool pop ( T & item)
inline

Attempts to pop an item off the work queue. It will block until data is available or finish() has been called.

Parameters
[out]itemIf pop returns true, it contains the popped item. If pop returns false, it is unmodified.
Returns
True upon success. False if the queue is empty and finish() has been called.

◆ pop() [2/3]

template<typename T >
bool pop ( T & item)
inline

Attempts to pop an item off the work queue. It will block until data is available or finish() has been called.

Parameters
[out]itemIf pop returns true, it contains the popped item. If pop returns false, it is unmodified.
Returns
True upon success. False if the queue is empty and finish() has been called.

◆ pop() [3/3]

template<typename T >
bool pop ( T & item)
inline

Attempts to pop an item off the work queue. It will block until data is available or finish() has been called.

Parameters
[out]itemIf pop returns true, it contains the popped item. If pop returns false, it is unmodified.
Returns
True upon success. False if the queue is empty and finish() has been called.

◆ push() [1/3]

template<typename T >
bool push ( T && item)
inline

Push an item onto the work queue. Notify a single thread that work is available. If finish() has been called, do nothing and return false. If push() returns false, then item has not been moved from.

Parameters
itemItem to push onto the queue.
Returns
True upon success, false if finish() has been called. An item was pushed iff push() returns true.

◆ push() [2/3]

template<typename T >
bool push ( T && item)
inline

Push an item onto the work queue. Notify a single thread that work is available. If finish() has been called, do nothing and return false. If push() returns false, then item has not been moved from.

Parameters
itemItem to push onto the queue.
Returns
True upon success, false if finish() has been called. An item was pushed iff push() returns true.

◆ push() [3/3]

template<typename T >
bool push ( T && item)
inline

Push an item onto the work queue. Notify a single thread that work is available. If finish() has been called, do nothing and return false. If push() returns false, then item has not been moved from.

Parameters
itemItem to push onto the queue.
Returns
True upon success, false if finish() has been called. An item was pushed iff push() returns true.

◆ setMaxSize() [1/3]

template<typename T >
void setMaxSize ( std::size_t maxSize)
inline

Sets the maximum queue size. If maxSize == 0 then it is unbounded.

Parameters
maxSizeThe new maximum queue size.

◆ setMaxSize() [2/3]

template<typename T >
void setMaxSize ( std::size_t maxSize)
inline

Sets the maximum queue size. If maxSize == 0 then it is unbounded.

Parameters
maxSizeThe new maximum queue size.

◆ setMaxSize() [3/3]

template<typename T >
void setMaxSize ( std::size_t maxSize)
inline

Sets the maximum queue size. If maxSize == 0 then it is unbounded.

Parameters
maxSizeThe new maximum queue size.

◆ waitUntilFinished() [1/3]

template<typename T >
void waitUntilFinished ( )
inline

Blocks until finish() has been called (but the queue may not be empty).

◆ waitUntilFinished() [2/3]

template<typename T >
void waitUntilFinished ( )
inline

Blocks until finish() has been called (but the queue may not be empty).

◆ waitUntilFinished() [3/3]

template<typename T >
void waitUntilFinished ( )
inline

Blocks until finish() has been called (but the queue may not be empty).


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