# include "pantasks.h"

/** things related to CheckInputs **/

static int CheckInputsRun = TRUE;

void CheckInputsSetState (int state) {
  CheckInputsRun = state;
}
int CheckInputsGetState () {
  return (CheckInputsRun);
}

void *CheckInputsThread (void *data) {

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

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

    // one run of the task checker
    SerialThreadLock ();
    CheckInputs ();
    SerialThreadUnlock ();
    fprintf (stderr, "I");
    usleep (10000); // allow other threads a chance to run
  }
}
