Project

General

Profile

« Previous | Next » 

Revision 4f6113f8

Added by David Sorber almost 8 years ago

Converted PCA to be multithreaded and use libpackjpg instead of calling
the old packjpg executable. This works much better! Need to handle a few
error conditions and do some more testing with decompress.

View differences:

software/photo_compress_archiver/ProtectedAndSynchronizedQueue.h
#include <condition_variable>
#include <iostream>
template<class T>
class ProtectedAndSynchronizedQueue
{
......
virtual ~ProtectedAndSynchronizedQueue() {};
/*
* add a new element to the back of the queue
*/
// add a new element to the back of the queue
void push_back(T newElement)
{
{
......
m_CV.notify_one();
}
/*
* retrieve the first element of the queue and remove it
* from the queue
*/
// retrieve the first element of the queue and remove it
// from the queue
T pop_front()
{
// Wait on queue blocking
......
return elementToReturn;
}
/*
* retrieve the first element of the queue and remove it
* from the queue
*/
// retrieve the first element of the queue and remove it
// from the queue
T pop_front(bool waitOnEmptyQueue, bool& elementReturned)
{
// Wait on queue blocking
......
else
{
elementReturned = false;
elementToReturn = m_queue.front();
}
muxLock.unlock();
return elementToReturn;
}
/*
* terminate any waiting pop_front() requests
*/
// terminate any waiting pop_front() requests
void terminate()
{
m_terminateFlag = true;
......
return m_queue.empty();
}
uint64_t size()
uint32_t size()
{
std::lock_guard<std::mutex> lock(m_mutex);
return m_queue.size();
......
};
#endif

Also available in: Unified diff