git-svn-id: https://svn.microneil.com/svn/SNF4CGP/trunk@36 59e8e3e7-56fa-483b-b4b4-fa6ab0af3dfcmaster
} | } | ||||
void ExecutiveProcess::initializeJobPool() { | void ExecutiveProcess::initializeJobPool() { | ||||
Jobs.init(ConfigInfo, Output); | |||||
Jobs.init(VersionInfo, ConfigInfo, Output); | |||||
} | } | ||||
void ExecutiveProcess::initializeWorkerPool() { | void ExecutiveProcess::initializeWorkerPool() { |
// Watch out -- Initializing the JobPool also means starting up SNFMulti and | // Watch out -- Initializing the JobPool also means starting up SNFMulti and | ||||
// the ScannerPool. | // the ScannerPool. | ||||
void JobPool::init(string Configuration, OutputProcessor& O) { // Initialize the JobPool. | |||||
void JobPool::init( | |||||
string VersionInfo, | |||||
string Configuration, | |||||
OutputProcessor& O) { | |||||
Output_ = &O; | Output_ = &O; | ||||
Scanners().init(Configuration); | |||||
Scanners().init(VersionInfo, Configuration); | |||||
ScopeMutex Busy(AllocationMutex); | ScopeMutex Busy(AllocationMutex); | ||||
Job* FirstJob = makeJob(); | Job* FirstJob = makeJob(); | ||||
Jobs.give(FirstJob); | Jobs.give(FirstJob); |
public: | public: | ||||
JobPool(); // Basic construction. | JobPool(); // Basic construction. | ||||
~JobPool(); // Safe cleanup on destruction. | ~JobPool(); // Safe cleanup on destruction. | ||||
void init(string Configuration, OutputProcessor& O); // Get ready to allocate jobs. | |||||
void init( // Get ready to allocate jobs. | |||||
const string VersionInfo, | |||||
const string Configuration, | |||||
OutputProcessor& O); | |||||
Job& grab(); // Get a fresh job object. | Job& grab(); // Get a fresh job object. | ||||
void drop(Job& J); // Drop a used job object. | void drop(Job& J); // Drop a used job object. | ||||
void stop(); // Shutdown and clean up. | void stop(); // Shutdown and clean up. |
return (*Rulebase_); | return (*Rulebase_); | ||||
} | } | ||||
void ScannerPool::init(const string Configuration) { // Get ready to provide scanners. | |||||
void ScannerPool::init(const string VersionInfo, const string Configuration) { // Get ready to provide scanners. | |||||
Rulebase().PlatformVersion(VersionInfo); | |||||
Rulebase().open(Configuration.c_str(), "", ""); // Light up the rulebase manager. | Rulebase().open(Configuration.c_str(), "", ""); // Light up the rulebase manager. | ||||
ScopeMutex Busy(AllocationControl); | ScopeMutex Busy(AllocationControl); | ||||
Scanner* FirstScanner = makeScanner(); // Create our first scanner. | Scanner* FirstScanner = makeScanner(); // Create our first scanner. |
public: | public: | ||||
ScannerPool(); // Constructed simply. | ScannerPool(); // Constructed simply. | ||||
~ScannerPool(); // Cleans up when destroyed. | ~ScannerPool(); // Cleans up when destroyed. | ||||
void init(const string Configuration); // Get ready to provide scanners. | |||||
void init(const string VersionInfo, const string Configuration); // Get ready to provide scanners. | |||||
void stop(); // Shutdown and clean up. | void stop(); // Shutdown and clean up. | ||||
Scanner& grab(); // Provides a Scanner from the pool. | Scanner& grab(); // Provides a Scanner from the pool. | ||||
void drop(Scanner& S); // Returns a Scanner to the pool. | void drop(Scanner& S); // Returns a Scanner to the pool. |