예제 #1
0
void IoModule::logic_init_lamp_machinestat()
{
	pMachine = new QStateMachine(this);
	m_pTimer = new QTimer(this);
	m_pTimer->setSingleShot(true);
	QState *pInitS = new QState();
	QState *pInitS1 = new QState(pInitS);
	QState *pInitS2 = new QState(pInitS);
	QState *pInitS3 = new QState(pInitS);
	QState *pInitS4 = new QState(pInitS);
	pInitS->setInitialState(pInitS1);
	pInitS1->addTransition(m_pTimer, SIGNAL(timeout()), pInitS2);
	pInitS2->addTransition(m_pTimer, SIGNAL(timeout()), pInitS3);
	pInitS3->addTransition(m_pTimer, SIGNAL(timeout()), pInitS4);
	pInitS4->addTransition(this, SIGNAL(resetMachine()), pInitS1);

	QState *pOperationS = new QState();
	//pInitS->addTransition(this, SIGNAL(initLampSuccess()),pOperationS);
	pMachine->addState(pInitS);//³õʼ»¯×´Ì¬;
	pMachine->addState(pOperationS);//²Ù×÷״̬;
	pMachine->setInitialState(pInitS);

	connect(pInitS1, SIGNAL(entered()), this, SLOT(init_s1()));
	connect(pInitS2, SIGNAL(entered()), this, SLOT(init_s2()));
	connect(pInitS3, SIGNAL(entered()), this, SLOT(init_s3()));
	connect(pInitS4, SIGNAL(entered()), this, SLOT(init_s4()));
	connect(pOperationS, SIGNAL(entered()), this, SLOT(operation_s()));
	
}
예제 #2
0
파일: s2.cpp 프로젝트: dCache/s2
int
main(int argc, char *argv[])
{
  int i;					/* loop counter */

  /* Initialisation */
  init_s2();

  /* Close all open diagnose streams at exit */
  atexit(exit_handler);         /* normal exit */

  /* Parse command line options */
  i = parse_cmd_opts(argc, argv);

  tp_init(opts.tp_size);

#if 0
#define MAX_REQUESTS	5
  int data[MAX_REQUESTS];
  /* run a loop that generates requests */
  for (i = 0; i < MAX_REQUESTS; i++) {
    data[i] = i;
    tp_enqueue(&data[i], NULL, NULL);
  }
#else
  int a = 1, b = 2, c = 3, d = 4;

  sleep(1);
  tp_enqueue(&a, NULL, NULL);
  tp_enqueue(&b, NULL, NULL);
  tp_enqueue(&c, NULL, NULL);
  tp_enqueue(&d, NULL, NULL);
  tp_dequeue(&c);
#endif

//  sleep(10);

  tp_cleanup();

  /* Parse and evaluate S2 language file(s) */
  if(0) s2_run(argc, argv, i);

  return 0;
}
예제 #3
0
파일: s2.cpp 프로젝트: dCache/s2
int
main(int argc, char *argv[])
{
  int i;
  uint rval;

  /* Initialisation */
  init_s2();

  /* Close all open diagnose streams at exit */
  atexit(exit_handler);         /* normal exit */

  /* Parse command line options */
  i = parse_cmd_opts(argc, argv);

  /* Parse and evaluate S2 language file(s) */
  rval = s2_run(argc, argv, i);

  return (int)rval;
}