Ejemplo n.º 1
0
bool master_service::thread_on_read(acl::socket_stream* conn)
{
	if (conf_ == NULL)
		return do_run(*conn, NULL);

	acl::polarssl_io* ssl = setup_ssl(*conn, *conf_);
	if (ssl == NULL)
		return false;

	if (ssl->handshake() == false)
	{
		logger_error("ssl handshake failed");
		return false;
	}

	if (ssl->handshake_ok() == false)
	{
		logger("handshake trying again...");
		return true;
	}

	logger("handshake_ok");

	return do_run(*conn, ssl);
}
Ejemplo n.º 2
0
stop_reason_enum uvm_phase_controller::start(void) 
{
    // Execute PRE_RUN common schedule - serially
    do_prerun();

    // Schedule RUN schedules
    do_run();

    // Start the simulation - execute spawned runtime schedules threads
    // sc_simcontext * context = sc_get_curr_simcontext();
    // context->co_simulate(m_duration);
    try
    {
        QUASI_STATIC_PREPARE_TO_SIMULATE();
        UVM_SC_CO_SIMULATE(m_duration);
    }
    catch(int)
    {
        m_stop_reason = UVM_STOP_REASON_RUN_PHASE_FATAL;
    }

    print_stop_reason(m_stop_reason);


    // Execute POST_RUN common schedule - serially
    do_postrun();

    return m_stop_reason;

}
Ejemplo n.º 3
0
void FormOptimization::on_pushStart_clicked()
{

  spectra_.clear();
  fitter_opt_ = Qpx::Fitter();
  peaks_.clear();
  setting_values_.clear();
  setting_fwhm_.clear();
  val_min = ui->doubleSpinStart->value();
  val_max = ui->doubleSpinEnd->value();
  val_d = ui->doubleSpinDelta->value();
  val_current = val_min;

  current_setting_ = ui->comboSetting->currentText().toStdString();

  ui->PlotCalib->setFloatingText("");
  ui->PlotCalib->clearGraphs();

  ui->tableResults->clear();
  ui->tableResults->setHorizontalHeaderItem(0, new QTableWidgetItem(QString::fromStdString(current_setting_), QTableWidgetItem::Type));
  ui->tableResults->setHorizontalHeaderItem(1, new QTableWidgetItem("Energy", QTableWidgetItem::Type));
  ui->tableResults->setHorizontalHeaderItem(2, new QTableWidgetItem("FWHM", QTableWidgetItem::Type));
  ui->tableResults->setHorizontalHeaderItem(3, new QTableWidgetItem("area", QTableWidgetItem::Type));
  ui->tableResults->setHorizontalHeaderItem(4, new QTableWidgetItem("%error", QTableWidgetItem::Type));

  do_run();
}
Ejemplo n.º 4
0
 void migrate_manager::run(tbsys::CThread *thread, void *arg)
 {
    is_alive = true;
    while (true) {
       mutex.lock();
       if (is_signaled) {
          is_signaled = false;
          mutex.unlock();
       } else {
          mutex.unlock();
          condition.wait(0);
       }
       if (_stop){
          break;
       }
       is_running = 1;
       is_stopped = false;
       uint64_t before, after;
       before = tbsys::CTimeUtil::getTime();
       do_run();
       after = tbsys::CTimeUtil::getTime();
       uint64_t interval = after - before;
       log_debug("this migrate consume time:%llu", interval);
       {
          tbsys::CThreadGuard guard(&mutex);
          is_running = 0;
          is_stopped = false;
       }
    }
    is_alive = false;
 }
Ejemplo n.º 5
0
int CudaKernel::run_nocheck(long gWorkSizeX, long gWorkSizeY, long lWorkSizeX, long lWorkSizeY)
{
   setDims(gWorkSizeX, gWorkSizeY, 1, lWorkSizeX, lWorkSizeY, 1, false);
   int runResult = do_run();
   handleCallError(kernelName);
   return runResult;
}
Ejemplo n.º 6
0
/**
 * Configuration is read from config file and right methods dispatched
 * based on arguments given to file.
 */
int dispatch_from_args(int argc, char **argv)
{
	int c;
	const char *error;

	if ((error = read_conf("aids.cfg")) != NULL)
	{
		logger(stderr, ERROR, "Error reading config file: %s", error);
		return 2;
	}

	if (argc == 1)
	{
		do_run();
		return 1;
	} else
	{
		while ((c = getopt(argc, argv, "k")) != -1)
		{
			switch (c)
			{
				case 'k':
					eradicate(aids_conf.pid_file);
					break;

				case '?':
					printf("Usage: %s [-k]\n\n-k kill working aids server", argv[0]);
					break;
			}
		}
		return c;
	}

}
Ejemplo n.º 7
0
int CudaKernel::run_nocheck(long global_work_size, long local_work_size)
{
   setDims(global_work_size, 1, 1, local_work_size, 1, 1, false);
   int runResult = do_run();
   handleCallError(kernelName);
   return runResult;
}
Ejemplo n.º 8
0
int CudaKernel::run(long gWorkSizeX, long gWorkSizeY, long gWorkSizeF,
                  long lWorkSizeX, long lWorkSizeY, long lWorkSizeF)
{
   setDims(gWorkSizeF, gWorkSizeX, gWorkSizeY, lWorkSizeF, lWorkSizeX, lWorkSizeY);
   int runResult = do_run();
   handleCallError(kernelName);
   return runResult;
}
Ejemplo n.º 9
0
void Backend::run(NetworkBase &network, Real duration) const
{
	if (duration <= 0.0) {
		duration =
		    network.duration() + AUTO_TIME_EXTENSION;  // Auto time extension
	}
	do_run(network, duration);  // Now simply execute the network
}
Ejemplo n.º 10
0
static void runcl(GtkWidget * entry, gpointer data)
{
    gchar *cmd = gtk_entry_get_text(GTK_ENTRY(entry));
    if (do_run(cmd, FALSE)) {
        // save history
        put_history(cmd, FALSE, History);
    }
    gtk_entry_set_text(GTK_ENTRY(entry), "");
};
Ejemplo n.º 11
0
	/// Starts the testing. All tests in this suite and embedded suites will
	/// be executed.
	///
	/// \param output          Progress report destination.
	/// \param cont_after_fail Continue functions despite failures.
	///
	/// \return True if no test failed; false otherwise.
	///
	bool
	Suite::run(Output& output, bool cont_after_fail)
	{
		int ntests = total_tests();
		output.initialize(ntests);
		do_run(&output, cont_after_fail);
		output.finished(ntests, total_time(true));
		return _success;
	}
Ejemplo n.º 12
0
/*
 *  Process pixels from 'a' to 'b' inclusive.
 *  The results are sent back all at once.
 *  Limitation:  may not do more than 'width' pixels at once,
 *  because that is the size of the buffer (for now).
 */
void
ph_lines(struct pkg_conn *UNUSED(pc), char *buf)
{
    int		a, b, fr;
    struct line_info	info;
    struct rt_i	*rtip = APP.a_rt_i;
    struct	bu_external	ext;

    RT_CK_RTI(rtip);

    if (debug > 1)  fprintf(stderr, "ph_lines: %s\n", buf);
    if (!seen_gettrees)  {
	bu_log("ph_lines:  no MSG_GETTREES yet\n");
	return;
    }
    if (!seen_matrix)  {
	bu_log("ph_lines:  no MSG_MATRIX yet\n");
	return;
    }

    a=0;
    b=0;
    fr=0;
    if (sscanf(buf, "%d %d %d", &a, &b, &fr) != 3)
	bu_exit(2, "ph_lines:  %s conversion error\n", buf);

    srv_startpix = a;		/* buffer un-offset for view_pixel */
    if (b-a+1 > srv_scanlen)  b = a + srv_scanlen - 1;

    rtip->rti_nrays = 0;
    info.li_startpix = a;
    info.li_endpix = b;
    info.li_frame = fr;

    rt_prep_timer();
    do_run(a, b);
    info.li_nrays = rtip->rti_nrays;
    info.li_cpusec = rt_read_timer((char *)0, 0);
    info.li_percent = 42.0;	/* for now */

    if (!bu_struct_export(&ext, (void *)&info, desc_line_info))
	bu_exit(98, "ph_lines: bu_struct_export failure\n");

    if (debug)  {
	fprintf(stderr, "PIXELS fr=%d pix=%d..%d, rays=%d, cpu=%g\n",
		info.li_frame,
		info.li_startpix, info.li_endpix,
		info.li_nrays, info.li_cpusec);
    }
    if (pkg_2send(MSG_PIXELS, (const char *)ext.ext_buf, ext.ext_nbytes, (const char *)scanbuf, (b-a+1)*3, pcsrv) < 0)  {
	fprintf(stderr, "MSG_PIXELS send error\n");
	bu_free_external(&ext);
    }

    bu_free_external(&ext);
}
Ejemplo n.º 13
0
void CPUThread::run()
{
	Emu.SendDbgCommand(DID_START_THREAD, this);

	init_stack();
	init_regs();
	do_run();

	Emu.SendDbgCommand(DID_STARTED_THREAD, this);
}
Ejemplo n.º 14
0
void		run_command(t_env *env, char *command)
{
	char	**splitted;

	if (!(splitted = ft_strsplit(command, ' ')))
		ft_exit("client: can't split command", EXIT_FAILURE);
	if (splitted[0])
	{
		if (!do_run(env, splitted))
			ft_putendl("unknown command");
	}
	splitted_free(splitted);
}
Ejemplo n.º 15
0
inline void
Racer::siderun(double tmintv)
{
	SpeedType& v0   = sidespeed_;
	SpeedType  vt   = v0;
	actual_maxspd_  = sidespd;
//	SpeedType  vt   = v0 + sideacc_ * tmintv;
//	actual_maxspd_  = maxspeed * 0.5;

	if (v0 > 0.0) {
		do_run(pos_.y, v0, vt, tmintv, 1, false);
	} else if (v0 < 0.0) {
		do_run(pos_.y, v0, vt, tmintv, -1, false);
	}

/*	if ( side_stoppable_ ) { // stoppable side run
		if ( v0 < 0.0 ) {
			if ( vt > 0.0 ) {
				vt = 0.0;
			}
			do_run(pos_.y, v0, vt, tmintv, -1);
		} else if ( v0 > 0.0 ) {
			if ( vt < 0.0 ) {
				vt = 0.0;
			}
			do_run(pos_.y, v0, vt, tmintv, 1);
		}
	} else { // unstoppable side run
		if ( vt > actual_maxspd_ ) {
			vt = actual_maxspd_;
		} else if (vt < -actual_maxspd_) {
			vt = -actual_maxspd_;
		}

		static const int dir[] = { -1, 1 };
		do_run(pos_.y, v0, vt, tmintv, dir[sideacc_ > 0.0]);
	}*/
Ejemplo n.º 16
0
static void start(Info * info){
	mylogfd(SCHFD, "[sche]start\n");
    info->destP.x = gety(info)+100;
    info->destP.y = getx(info)+POSITI*200;
    do_run(info);
    if(IsBallSeen(info)) info->state = FORWARDING_BALL;
    if(checkDone()) info->state = SEARCH_BALL;
    /* if(checkDone()) { 
    mylogfd(SCHFD, "[sche]rotate_end\n");
                 //  do_forward -- redwalker
    if(checkDone()){
        info->state = SEARCH_BALL;
        mylogfd(SCHFD,"[sche]start->search_ball\n");
    }*/
}
Ejemplo n.º 17
0
  *---------------------------------------------------------*/
inline void
Racer::uprun(double tmintv)
{
	SpeedType& v0	  = upspeed_;
	SpeedType  vt	  = v0 + upacc_ * tmintv;
//	actual_maxspd_	  = ((side_stoppable_ && (upacc_ > -1.1)) ? maxspeed : maxspeed * 0.8);
	actual_maxspd_	  = maxspeed;

	if (vt > actual_maxspd_) {
		vt = actual_maxspd_;
	} else if (vt < 0.0) {
		vt = 0.0;
	}
	do_run(pos_.x, v0, vt, tmintv);
Ejemplo n.º 18
0
	void uthread_impl::after_swap()
	{
		uthread_impl *p = prev;

		if(p->mSuspended)
		{
			p->remove();
			p->do_run();
			p->release();
		}

		if(mDead)
			throw std::runtime_error("Dead uthread resumed!");
		else
			do_run();
	}
Ejemplo n.º 19
0
void FormOptimization::run_completed() {
  if (my_run_) {
    PL_INFO << "<Optimization> Run completed";

    if (val_current < val_max) {
      PL_INFO << "<Optimization> Completed test " << val_current << " < " << val_max;
      val_current += val_d;
      do_run();
    } else {
      PL_INFO << "<Optimization> Done optimizing";
      my_run_ = false;
      ui->pushStop->setEnabled(false);
      emit toggleIO(true);
    }
  }
}
Ejemplo n.º 20
0
/* ========================================================================
   Name:        usbApp
   Description: This function is called to use the USB boot
   ======================================================================== */
void usbApp(void)
{
	char *arg[] = {"run", "bootcmd"};
	char *usb[] = {"usb","reset"};

	/* (re)Start the USB */
	do_usb(NULL, 0, 2, usb);

	/* Set the Bootargs */
	setenv("bootargs","");
	setenv("bootcmd","fatload usb 0 84000000 app.ub;bootm 84000000");

	/* Start the Factory Application */
	do_run (NULL, 0, 2, arg);

	/* We should not come back ... */
	while(1);
}
void do_observe(void) {
    while (1) {
        do_run();

        switch (exception) {
        case NO_EXCEPTION:
            break;
        case EXCEPTION_QUIT:
            dump_stats();
            return;
        case EXCEPTION_FATAL:
            fprintf(stderr, "Fatal error...\n");
            return;
        case EXCEPTION_BACKTRACK:
            worldsens_scheduler_backtrack();
            break;
        }
    }
}
Ejemplo n.º 22
0
static gboolean entry_keypress_cb(GtkWidget *entry, GdkEventKey *event, gpointer user_data)
{
    static gboolean terminal = FALSE; /* Run in a terminal?      */
    gchar *cmd               = NULL;  /* command line to execute */
    XFCommand *hitem         = NULL;  /* history item data       */
    
    switch (event->keyval) {
        case GDK_Down:
            scroll_history(TRUE,1);
            if (Curr) {
                hitem = (XFCommand *) Curr->data;
                terminal = hitem->in_terminal;
                gtk_entry_set_text(GTK_ENTRY(entry), hitem->command);
            }
            return TRUE;
        case GDK_Up:
            scroll_history(FALSE,1);
            if (Curr) {
                hitem = (XFCommand *) Curr->data;
                terminal = hitem->in_terminal;
                gtk_entry_set_text(GTK_ENTRY(entry), hitem->command);
            }
            return TRUE;
        case GDK_Return:
            cmd = gtk_entry_get_text(GTK_ENTRY(entry));
            
            if ((event->state) & GDK_CONTROL_MASK) {
                terminal = TRUE;
            }

            if (do_run(cmd, terminal)) {
                put_history(cmd, terminal, History);      /* save this cmdline to history       */
                History  = get_history();                 /* reload modified history            */
                Curr     = NULL;                          /* reset current history item pointer */
                terminal = FALSE;                         /* Reset run in term flag             */
                gtk_entry_set_text(GTK_ENTRY(entry), ""); /* clear the entry                    */
            }
            return TRUE;
        default:
            /* hand over to default signal handler */
            return FALSE;
    }                           
}
Ejemplo n.º 23
0
int
main(int argc, const char *const argv[]) {
  size_t nthds = 8;
  ssize_t nputs = 1000LL * 1000LL * 10LL;
  pid_t c_pid;

  if (argc >= 2) {
    size_t n;
    if (lagopus_str_parse_int64(argv[1], (int64_t *)&n) ==
        LAGOPUS_RESULT_OK) {
      if (n > 0) {
        nthds = (size_t)n;
      }
    }
  }
  if (argc >= 3) {
    ssize_t n;
    if (lagopus_str_parse_int64(argv[2], (int64_t *)&n) ==
        LAGOPUS_RESULT_OK) {
      if (n > 0) {
        nputs = (ssize_t)n;
      }
    }
  }

  (void)lagopus_signal(SIGHUP, s_sighandler, NULL);
  (void)lagopus_signal(SIGINT, s_sighandler, NULL);

  c_pid = fork();
  if (c_pid == 0) {
    is_child = true;
    return do_run(nthds, nputs);
  } else if (c_pid > 0) {
    int st;
    (void)waitpid(c_pid, &st, 0);
    return 0;
  } else {
    perror("fork");
    return 1;
  }
}
Ejemplo n.º 24
0
Archivo: main.c Proyecto: jingyur/movie
void start()
{
	theatre* wd = theatre_create("Wanda");
	theatre* xm = theatre_create("Xingmei");

    movie* mw = movie_create("Wow", "John", 9);
    movie* mx = movie_create("X-Man", "Monica", 7);
    movie* mb = movie_create("Bird", "Jack", 8);

    movie_append(mw,mx);
    movie_append(mw,mb);

	init_hall_random(70,wd, mw);
	init_hall_random(40,wd, mw);
	init_hall_random(50,wd, mx);
	init_hall_random(90,wd, mx);
	init_hall_random(150,wd, mb);
	init_hall_random(130,xm, mw);
	init_hall_random(120,xm, mw);
	init_hall_random(100,xm, mx);
	init_hall_random(80,xm, mb);

	do_run(mw);
}
Ejemplo n.º 25
0
/* ========================================================================
   Name:        initFtaLib
   Description: Initialize all IO peripherals related to FTA
   ======================================================================== */
void initFtaLib(void)
{
	U32 flag = 0;
	I8 *env;
	I8 selftest  = SELFTEST_ON;
	I8 selfstart = SELFSTART_V2F;
	I8 *arg[]    = {"run", "bootcmd"};

	/* We are "saving" the current configuration, because it is not valid after a setenv() */
	env = getenv("selftest");
	if(env)
		selftest = env[0];

	env = getenv("selfstart");
	if(env)
		selfstart = env[0];


#if defined(USE_DISPLAY)
	/* Init the use of the video */
	init_display();
	setVideoPio();

	/* Display something on screen */
	init_osd();
	display = TRUE;
#endif

	splash_update(64);

	/* Go to the prompt (Do not start automatically any application) */
	if( (getKeyPressed() & FP_KEY_DOWN) || (selfstart == SELFSTART_UBOOT) ) {
		setenv("bootcmd", NULL);
		return;
	}

	splash_update(128);

	/* U-Boot Self test */
	if(selftest == SELFTEST_ON)
	{
		if( test_fta() ) {
			hang();
		}
		else {
			setenv("selftest","0");
			saveenv();
		}
	}

	if( getKeyPressed() & FP_KEY_POWER ) {
		usbApp();
	}

	splash_update(256);
	if(selfstart == SELFSTART_NFS) {
		/* Set the Kernel (DEV) as the main application */
		setenv("bootcmd","bootm 0x80000");
	}
	else {
		/* Set the V2F as the main application
		 * The address provided is in the RAM, so clear it to avoid confusion
		 * (in case of some remaining data)
		 */
		memset((void *)0x80801000, 0, sizeof(ssa_header_t));
		setenv("bootcmd","bootm 0x80801000");
	}

	/* Set the Loader as the main application */
	if( getKeyPressed() & FP_KEY_UP ) {
		setenv("bootcmd","bootm 0x2C0000");
	}

	/* Set the Loader as the main application */
	if (!eeprom_read(CFG_I2C_EEPROM_ADDR, EEPROM_SSD_REG, (unsigned char*)&flag, sizeof(flag))) {
		if(flag == FORCE_UPDATE_CODE) {
			setenv("bootcmd","bootm 0x2C0000");
		}
	}

	do_run (NULL, 0, 2, arg);
}
Ejemplo n.º 26
0
// run
/////////
void run_ea(eoAlgo<eoReal<double> >& _ga, eoPop<eoReal<double> >& _pop)
{
  do_run(_ga, _pop);
}
Ejemplo n.º 27
0
void run_ea(eoAlgo<eoReal<eoMinimizingFitness> >& _ga, eoPop<eoReal<eoMinimizingFitness> >& _pop)
{
  do_run(_ga, _pop);
}
Ejemplo n.º 28
0
int
main(int argc, char *argv[])
{
  struct QOP_MDWF_State *mdwf_state = NULL;
  struct QOP_MDWF_Parameters *mdwf_params = NULL;
  QMP_thread_level_t qt = QMP_THREAD_SINGLE;
  int status = 1;
  int i;

  if (QMP_init_msg_passing(&argc, &argv, qt, &qt) != QMP_SUCCESS) {
    fprintf(stderr, "QMP_init() failed\n");
    return 1;
  }

  for (i = 0; i < NELEM(b5); i++) {
    b5[i] = 0.1 * i * (NELEM(b5) - i);
    c5[i] = 0.1 * i * i * (NELEM(b5) - i);
  }

  self = QMP_get_node_number();
  primary = QMP_is_primary_node();
  if (argc != 7) {
    zprint("7 arguments expected, found %d", argc);
    zprint("usage: localheat Lx Ly Lz Lt Ls time");
    QMP_finalize_msg_passing();
    return 1;
  }

  for (i = 0; i < 4; i++) {
    mynetwork[i] = 1;
    mylocal[i] = atoi(argv[i+1]);
    mylattice[i] = mylocal[i] * mynetwork[i];
  }
  mylocal[4] = mylattice[4] = atoi(argv[5]);
  total_sec = atoi(argv[6]);

  zshowv4("network", mynetwork);
  zshowv5("local lattice", mylocal);
  zshowv5("lattice", mylattice);
  zprint("total requested runtime %.0f sec", total_sec);

#if 0
  if (QMP_declare_logical_topology(mynetwork, 4) != QMP_SUCCESS) {
    zprint("declare_logical_top failed");
    goto end;
  }

  getv(mynode, 0, QMP_get_logical_number_of_dimensions(),
       QMP_get_logical_coordinates());
#else
  { int i;
    for (i = 0; i < 4; i++)
       mynode[i] = 0;
  }
#endif

  if (QOP_MDWF_init(&mdwf_state,
		    mylattice, mynetwork, mynode, primary,
		    getsub, NULL)) {
    zprint("MDWF_init() failed");
    goto end;
  }

  zprint("MDWF_init() done");

  if (QOP_MDWF_set_generic(&mdwf_params, mdwf_state, b5, c5, 0.123, 0.05)) {
    zprint("MDW_set_generic() failed");
    goto end;
  }
  zprint("MDWF_set_generic() done");

  if (do_run(mdwf_state, mdwf_params)) {
    zprint("float test failed");
    goto end;
  }

  QOP_MDWF_fini(&mdwf_state);

  zprint("Heater test finished");
  status = 0;
 end:
  QMP_finalize_msg_passing();
  return status;
}
Ejemplo n.º 29
0
void* guard_action::run(void)
{
	do_run();
	delete this;
	return NULL;
}
Ejemplo n.º 30
0
int main(int argc, char *argv[])
{
    do_run();
    return 0;
}