Преглед на файлове

Added clearJob()

git-svn-id: https://svn.microneil.com/svn/SNF4CGP/trunk@20 59e8e3e7-56fa-483b-b4b4-fa6ab0af3dfc
master
madscientist преди 15 години
родител
ревизия
2111d2b112
променени са 2 файла, в които са добавени 6 реда и са изтрити 0 реда
  1. 5
    0
      SNF4CGP/WorkerPool.cpp
  2. 1
    0
      SNF4CGP/WorkerPool.hpp

+ 5
- 0
SNF4CGP/WorkerPool.cpp Целия файл

@@ -37,6 +37,10 @@ Job& Worker::myJob() {
return(*myJob_);
}
void Worker::clearJob() { // Forget about the job.
myJob_ = 0;
}
LogicCheck CheckForOneJobAtATime("Worker::doJob() Check(false == isJob())");
void Worker::doJob(Job& J) { // Give this worker a job to do.
@@ -62,6 +66,7 @@ bool Worker::doWork() {
ScopeMutex CallTheBall(Busy); // We're busy - don't touch.
if(isJob()) { // Only do a job if we have one.
myJob().doIt();
clearJob();
return true;
}
return false;

+ 1
- 0
SNF4CGP/WorkerPool.hpp Целия файл

@@ -31,6 +31,7 @@ class Worker : private Thread {
Job* myJob_; // The job to do (or 0 to stop).
bool isJob(); // Job pointer check.
Job& myJob(); // Safe access to myJob.
void clearJob(); // Forget done jobs.
public:
Worker(WorkerPool& W); // Initialize and start the thread.

Loading…
Отказ
Запис