19 #ifndef _THREADSAFE_PERSISTED_QUEUE_HPP_
20 #define _THREADSAFE_PERSISTED_QUEUE_HPP_
22 #include <boost/scoped_ptr.hpp>
23 #include <boost/shared_ptr.hpp>
24 #include <boost/thread/mutex.hpp>
25 #include <boost/thread/locks.hpp>
33 template <
class _qoT,
class _sT>
38 const std::string& queueWorkingDir,
39 const unsigned maxItemsPerPage)
41 boost::lock_guard<boost::mutex> guard(objectMutex);
47 boost::lock_guard<boost::mutex> guard(objectMutex);
51 void push(boost::shared_ptr<_qoT> p)
53 boost::lock_guard<boost::mutex> guard(objectMutex);
54 persistedQ->push_back(p);
57 boost::shared_ptr<_qoT>
pop()
59 boost::lock_guard<boost::mutex> guard(objectMutex);
60 return persistedQ->pop_front();
65 boost::lock_guard<boost::mutex> guard(objectMutex);
66 return persistedQ->empty();
71 boost::lock_guard<boost::mutex> guard(objectMutex);
72 return persistedQ->size();
78 boost::scoped_ptr<PersistedQueue<_qoT, _sT> > persistedQ;
79 boost::mutex objectMutex;
Definition: persisted_queue.hpp:114
void push(boost::shared_ptr< _qoT > p)
Definition: threadsafe_persisted_queue.hpp:51
~ThreadsafePersistedQueue()
Definition: threadsafe_persisted_queue.hpp:45
boost::shared_ptr< _qoT > pop()
Definition: threadsafe_persisted_queue.hpp:57
size_t size()
Definition: threadsafe_persisted_queue.hpp:69
ThreadsafePersistedQueue(const std::string &queueName, const std::string &queueWorkingDir, const unsigned maxItemsPerPage)
Definition: threadsafe_persisted_queue.hpp:37
bool empty()
Definition: threadsafe_persisted_queue.hpp:63
Definition: statable_queue.hpp:8
Definition: threadsafe_persisted_queue.hpp:34