* fix build error with Mac OS X 10.4 (26 Jul 2005)
* fix sendfax crash with verbose output (25, 29 Jul 2005)
* fix a race with scheduled jobs to allow for coordinated
- batch sending (25 Jul 2005)
+ batch sending (25 Jul, 10 Aug 2005)
* fix some error conditions with JBIG and JPEG reception (25 Jul 2005)
* improve probemodem results for some modems (16 Jul 2005)
* correct cover sheet page count for some PDFs (14 Jul 2005)
}
void
-faxQueueApp::SchedTimeout::start()
+faxQueueApp::SchedTimeout::start(u_short s)
{
/*
* If we don't throttle the scheduler then large
* once per second.
*/
if (!started && Sys::now() > lastRun) {
- Dispatcher::instance().startTimer(0,1, this);
- lastRun = Sys::now();
+ Dispatcher::instance().startTimer(s, 1, this);
+ lastRun = Sys::now() + s;
started = true;
pending = false;
} else {
- if (!pending) {
+ if (!pending && lastRun <= Sys::now()) {
/*
* The scheduler is either running now or has been run
* within the last second and there are no timers set
* timer to go off in one second to avoid a stalled
* run queue.
*/
- Dispatcher::instance().startTimer(1,0, this);
- lastRun = Sys::now() + 1;
+ Dispatcher::instance().startTimer(s + 1, 0, this);
+ lastRun = Sys::now() + 1 + s;
pending = true;
}
}
* In order to deliberately batch jobs by using a common
* time-to-send we need to give time for the other jobs'
* timers to expire and to enter the run queue before
- * running the scheduler.
+ * running the scheduler. Thus the scheduler is poked
+ * with a delay.
*/
- sleep(1); // is this long enough?
- pokeScheduler();
+ pokeScheduler(1);
}
/*
* next time the dispatcher is invoked.
*/
void
-faxQueueApp::pokeScheduler()
+faxQueueApp::pokeScheduler(u_short s)
{
- schedTimeout.start();
+ schedTimeout.start(s);
}
/*
~SchedTimeout();
void timerExpired(long, long);
- void start();
+ void start(u_short s = 0);
};
// configuration stuff
fxStr configFile; // configuration filename
void unblockDestJobs(Job& job, DestInfo& di);
void runScheduler();
- void pokeScheduler();
+ void pokeScheduler(u_short s = 0);
// job preparation stuff
bool prepareJobNeeded(Job&, FaxRequest&, JobStatus&);
static void prepareCleanup(int s);