Browse Source

Created OutputProcessor skeleton.

git-svn-id: https://svn.microneil.com/svn/SNF4CGP/trunk@7 59e8e3e7-56fa-483b-b4b4-fa6ab0af3dfc
master
madscientist 15 years ago
parent
commit
5acf9059fc
2 changed files with 65 additions and 0 deletions
  1. 26
    0
      SNF4CGP/OutputProcessor.cpp
  2. 39
    0
      SNF4CGP/OutputProcessor.hpp

+ 26
- 0
SNF4CGP/OutputProcessor.cpp View File

@@ -1,3 +1,29 @@
// SNF4CGP/OutputProcessor.cpp
// Copyright (C) 2009 ARM Research Labs, LLC.
// See www.armresearch.com for more information.
#include "OutputProcessor.hpp"
const ThreadType OutputProcessor::Type("Output Processor");
const ThreadState OutputProcessor::WaitingForJobs("Waiting");
const ThreadState OutputProcessor::PostingResponses("Posting");
OutputProcessor::OutputProcessor(JobPool& J) : // Constructor sets up the basics.
Thread(OutputProcessor::Type, "Output"), // Name the thread.
RecycledJobs(J), // Tie in to the JobPool.
isTimeToStop(false) {} // Not time to stop.
OutputProcessor::~OutputProcessor() { // Destructor to clean things up.
}
void OutputProcessor::start() { // Start processing.
}
void OutputProcessor::outputJob(Job* J) { // Take this job and ... you know.
}
void OutputProcessor::stop() { // Finish off the queue and quit.
}
void OutputProcessor::myTask() { // This is how we do it.
}

+ 39
- 0
SNF4CGP/OutputProcessor.hpp View File

@@ -1,3 +1,42 @@
// SNF4CGP/OutputProcessor.hpp
// Copyright (C) 2009 ARM Research Labs, LLC
// See www.armresearch.com for more information.
//
// The OutputProcessor feeds responses back to CommuniGate from completed jobs
// and recycles jobs back into the JobPool. This is done in a separate thread so
// that the output stream (cout) is decoupled from the rest of the application.
// If the output stream blocks momentarily then only this thread is blocked while
// all other jobs continue to operate with full steam.
#ifndef IncludedOutputProcessor
#define IncludedOutputProcessor
#include "JobPool.hpp"
#include "../CodeDweller/threading.hpp"
class OutputProcessor : private Thread { // Process job outputs.
private:
JobPool& RecycledJobs; // Where we put our recycled jobs.
ProductionQueue<Job*> CompletedJobs; // Input queue for jobs to process.
bool isTimeToStop; // Flag for when we need to stop.
void myTask(); // Task for the thread. (my loop).
public:
OutputProcessor(JobPool& J); // Constructed with the JobPool.
~OutputProcessor(); // Destructor to clean things up.
void start(); // Start processing.
void outputJob(Job* J); // Take this job and ... you know.
void stop(); // Finish off the queue and quit.
const static ThreadType Type;
const static ThreadState WaitingForJobs;
const static ThreadState PostingResponses;
};
#endif

Loading…
Cancel
Save