int main (int argc, char **argv) { int c, option_index = 0; while ((c = getopt_long(argc, argv, options, long_options, &option_index)) != -1) { switch (c) { case 'h': usage(); exit(0); break; case 'k': driveKeynote = 1; break; default: usage(); exit(1); break; } } setupAndRun(); return 0; }
bool AgarServer::setupSimulation() { /****************Simulation setup********************/ simThread = new QThread(); simulation = new AgarCore(); //move simulation to its own thread simulation->moveToThread(simThread); connect( simThread, SIGNAL(started()), simulation, SLOT(setupAndRun() )); //connect( simulation, SIGNAL(workFinished()), simThread, SLOT(quit())); //automatically delete thread and task object when work is done: //connect( simThread, SIGNAL(finished()), simulation, SLOT(deleteLater()) ); //connect( simulation, SIGNAL(finished()), simThread, SLOT(deleteLater()) ); return true; }