예제 #1
0
static void
scan_timers ()
{
  LstLink(sNode) *nl, *nxtnl;
  plc_sTimer *tp;

  for (nl = LstFir(&timer_l); nl != LstEnd(&timer_l); nl = nxtnl) {
    tp = LstObj(nl)->timer;
    nxtnl = LstNex(nl);
    if (tp->TimerCount <= 1 || !tp->TimerFlag) {
      tp->TimerCount = 0;
      tp->TimerFlag = FALSE;
      LstRem(nl);
      LstNul(nl);
    } else {
      tp->TimerCount--;
    }
  }
}
예제 #2
0
파일: rt_tmon.c 프로젝트: Strongc/proview
static sTimer *
allocTimer (
)
{
  const int		cAllocCount = 100;
  sTimer		*ftp;
  LstLink(sTimer)	*ftl;
  int			i;

  if (LstEmp(&free_lh)) {
    ftp = (sTimer *) calloc(cAllocCount, sizeof(sTimer));
    for (i=0; i < cAllocCount; i++, ftp++) {
      LstIns(&LstEnd(free_lh), ftp, ll);
    }
  }

  ftl = LstFir(&free_lh);
  LstRem(ftl);
  return LstObj(ftl);
}
예제 #3
0
static void
reinit_nodes ()
{
  pwr_tStatus sts;
  LstLink(sNode) *nl;
  sNode *np;
  pwr_tObjid oid;

  /* Mark all links in the NodeLink list */
  for (nl= LstFir(&node_l); nl != LstEnd(&node_l); nl = LstNex(nl))
    LstObj(nl)->found = FALSE;

  for (
    sts = gdh_GetClassList(pwr_cClass_NodeLinkSup, &oid);
    ODD(sts);
    sts = gdh_GetNextObject(oid, &oid)
  ) {
    if ((np = get_nodes(oid)) == NULL) {
      np = init_node(oid, NULL, 1);
      if (np != NULL) {
	nl = LstIns(nl, np, node_l);
	np->found = TRUE;
      }
    } else {
      update_node(np);
    }
  }

  for (nl = LstFir(&node_l); nl != LstEnd(&node_l); nl = LstNex(nl)) {
    np = LstObj(nl);
    if (!np->found) {
      nl = LstPre(&np->node_l);
      LstRem(&np->node_l);
      LstNul(&np->node_l);
      gdh_SubUnrefObjectInfo (np->o->SubId);
      gdh_DLUnrefObjectInfo(np->dlid);
      free(np);
    }
  }	    
}