# include "pantasks.h"

/** things related to CheckJobs **/

static int CheckJobsRun = FALSE;

void CheckJobsSetState (int state) {
  CheckJobsRun = state;
}
int CheckJobsGetState () {
  return (CheckJobsRun);
}

void *CheckJobsThread (void *data) {

  gprintInit ();  // each thread needs to init the printing system
  while (1) {

    // check for thread suspend
    if (!CheckJobsRun) {
      usleep (100000); // idle if thread action is suspended
      continue;
    }

    // one run of the task checker
    SerialThreadLock ();
    CheckJobs ();
    SerialThreadUnlock ();
    usleep (10000); // allow other threads a chance to run
  }
}
