# include "pantasks.h"

# define MAX_DELAY 0.1
struct timeval start, last;
static int Ncheck = 0;

int CheckSystem () {

  gettimeofday (&start, (void *) NULL);

  if (Ncheck < 100) {
    CheckTasks ();
    CheckJobs ();
    Ncheck ++;
  } else {
    CheckController ();
    CheckControllerOutput ();
    Ncheck = 0;
  }
  /* ohana_memcheck (FALSE); */
  return (TRUE);
}

int TestElapsedCheck () {

  struct timeval stop;
  float dtime;

  gettimeofday (&stop, (void *) NULL);
  dtime = DTIME (stop, start);
  if (dtime > MAX_DELAY) return (TRUE);
  return (FALSE);
}

  /* do we really need to check the controller on every call?
     or perhaps alternate?
  */

void SerialThreadLock () {
    return;
}

void SerialThreadUnlock () {
    return;
}
