Lines Matching refs:scheduler
43 var scheduler = new Scheduler();
44 scheduler.addIdleTask(ID_IDLE, 0, null, COUNT);
48 scheduler.addWorkerTask(ID_WORKER, 1000, queue);
53 scheduler.addHandlerTask(ID_HANDLER_A, 2000, queue);
58 scheduler.addHandlerTask(ID_HANDLER_B, 3000, queue);
60 scheduler.addDeviceTask(ID_DEVICE_A, 4000, null);
62 scheduler.addDeviceTask(ID_DEVICE_B, 5000, null);
64 scheduler.schedule();
66 if (scheduler.queueCount != EXPECTED_QUEUE_COUNT ||
67 scheduler.holdCount != EXPECTED_HOLD_COUNT) {
69 "Error during execution: queueCount = " + scheduler.queueCount +
70 ", holdCount = " + scheduler.holdCount + ".";
89 * A scheduler can be used to schedule a set of tasks based on their relative
94 function Scheduler() {
115 * Add an idle task to this scheduler.
121 Scheduler.prototype.addIdleTask = function (id, priority, queue, count) {
126 * Add a work task to this scheduler.
131 Scheduler.prototype.addWorkerTask = function (id, priority, queue) {
136 * Add a handler task to this scheduler.
141 Scheduler.prototype.addHandlerTask = function (id, priority, queue) {
146 * Add a handler task to this scheduler.
151 Scheduler.prototype.addDeviceTask = function (id, priority, queue) {
162 Scheduler.prototype.addRunningTask = function (id, priority, queue, task) {
168 * Add the specified task to this scheduler.
174 Scheduler.prototype.addTask = function (id, priority, queue, task) {
181 * Execute the tasks managed by this scheduler.
183 Scheduler.prototype.schedule = function () {
199 Scheduler.prototype.release = function (id) {
215 Scheduler.prototype.holdCurrent = function () {
225 Scheduler.prototype.suspendCurrent = function () {
236 Scheduler.prototype.queue = function (packet) {
280 * be started by the scheduler.
358 * @param {Scheduler} scheduler the scheduler that manages this task
363 function IdleTask(scheduler, v1, count) {
364 this.scheduler = scheduler;
371 if (this.count == 0) return this.scheduler.holdCurrent();
374 return this.scheduler.release(ID_DEVICE_A);
377 return this.scheduler.release(ID_DEVICE_B);
388 * @param {Scheduler} scheduler the scheduler that manages this task
391 function DeviceTask(scheduler) {
392 this.scheduler = scheduler;
398 if (this.v1 == null) return this.scheduler.suspendCurrent();
401 return this.scheduler.queue(v);
404 return this.scheduler.holdCurrent();
414 * @param {Scheduler} scheduler the scheduler that manages this task
419 function WorkerTask(scheduler, v1, v2) {
420 this.scheduler = scheduler;
427 return this.scheduler.suspendCurrent();
441 return this.scheduler.queue(packet);
451 * @param {Scheduler} scheduler the scheduler that manages this task
454 function HandlerTask(scheduler) {
455 this.scheduler = scheduler;
477 return this.scheduler.queue(v);
482 return this.scheduler.queue(v);
485 return this.scheduler.suspendCurrent();