|
/********************************************************************
|
|
* 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"
|
|
#include "Logger/Logger.h"
|
|
#include "Utilities/ProtectedQueue.h"
|
|
|
|
|
|
namespace BlackLynx
|
|
{
|
|
namespace SearchLynx
|
|
{
|
|
|
|
class ExecDriver
|
|
{
|
|
public:
|
|
|
|
typedef ProtectedQueue<Chunk*> chunk_queue_t;
|
|
|
|
ExecDriver(
|
|
const std::string& inputFile,
|
|
uint32_t numReaderThreads,
|
|
uint32_t chunkSize);
|
|
|
|
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__
|