root/software/read_test/src/ExecDriver.h @ c8ea8b72
| a0d1d164 | David Sorber | /********************************************************************
|
||
* This software is "commercial computer software" as defined in the *
|
||||
* Federal Acquisition Regulations and is subject to BlackLynx *
|
||||
* Inc's standard End User License Agreement. *
|
||||
* *
|
||||
* CONFIDENTIAL - All source code is the propriety and confidential *
|
||||
* information of BlackLynx Inc. *
|
||||
* *
|
||||
* Copyright 2014-2020 BlackLynx Inc. *
|
||||
* Unpublished -- all rights reserved under the copyright laws *
|
||||
* of the United States. *
|
||||
********************************************************************/
|
||||
#ifndef __BLACKLYNX_EXECDRIVER_H__
|
||||
#define __BLACKLYNX_EXECDRIVER_H__
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
#include <vector>
|
||||
#include "Chunk.h"
|
||||
| f12339cf | david.sorber | #include "Logger/Logger.h"
|
||
#include "Utilities/ProtectedQueue.h"
|
||||
| a0d1d164 | David Sorber | |||
namespace BlackLynx
|
||||
{
|
||||
namespace SearchLynx
|
||||
{
|
||||
class ExecDriver
|
||||
{
|
||||
public:
|
||||
| f12339cf | david.sorber | typedef ProtectedQueue<Chunk*> chunk_queue_t;
|
||
| a0d1d164 | David Sorber | |||
ExecDriver(
|
||||
const std::string& inputFile,
|
||||
| f12339cf | david.sorber | uint32_t numReaderThreads,
|
||
uint32_t chunkSize);
|
||||
| a0d1d164 | David Sorber | |||
virtual ~ExecDriver();
|
||||
virtual void start();
|
||||
virtual void waitUntilComplete();
|
||||
void setupThreadBody(chunk_queue_t* outQueue, uint32_t numTerminators);
|
||||
void cleanupThreadBody(chunk_queue_t* inQueue);
|
||||
protected:
|
||||
virtual void readerThreadBody(
|
||||
chunk_queue_t* inQueue,
|
||||
chunk_queue_t* outQueue);
|
||||
const std::string& r_inputFile;
|
||||
uint32_t m_numReaderThreads;
|
||||
std::thread* p_setupThread;
|
||||
std::vector<std::thread*> m_readerThreads;
|
||||
std::thread* p_cleanupThread;
|
||||
uint32_t DEFAULT_CHUNK_SIZE;
|
||||
uint32_t EXTRA_BYTES_TO_READ;
|
||||
chunk_queue_t m_readerQueue;
|
||||
chunk_queue_t m_cleanupQueue;
|
||||
};
|
||||
}
|
||||
}
|
||||
#endif // __BLACKLYNX_EXECDRIVER_H__
|