# include "pantasks.h"

/** things related to CheckController **/

static int CheckControllerRun = FALSE;

void CheckControllerSetState (int state) {
  CheckControllerRun = state;
}
int CheckControllerGetState () {
  return (CheckControllerRun);
}

void *CheckControllerThread (void *data) {

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

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

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