# 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 ();
    if (VerboseMode() == 2) fprintf (stderr, "C");
    // fprintf (stderr, "**** C ****");
    usleep (500000); // allow other threads a chance to run
  }
}
