Esempio n. 1
0
int main (int argc, char* argv[]) {
	//Shared data
	bool running = true;
	std::string callbackString = "";
	int callbackStringLength = 0;

	Barrier newInput;
	Barrier newLength;
	Barrier finishedOutput;

	//Thread handler initialization
	InputHandler inputHandler(&running, &callbackString, &newInput, &finishedOutput);
	LogicHandler logicHandler(&running, &callbackString, &callbackStringLength, &newInput, &newLength);
	OutputHandler outputHandler(&running, &callbackString, &callbackStringLength, &newLength, &finishedOutput);

	//Threads
	std::thread inputThread(&InputHandler::run, &inputHandler);
	std::thread logicThread(&LogicHandler::run, &logicHandler);
	std::thread outputThread(&OutputHandler::run, &outputHandler);

	//Close program
	inputThread.join();
	logicThread.join();
	outputThread.join();
	return 0;
}
Esempio n. 2
0
	int startInputThread()
	{
		mShouldBeRunning = true;
		try {
			std::thread inputThread ( [this] {
				inputThreadFunc();
			});
			mInputThread = std::move( inputThread );
			return errNone;
		} catch (...) {
			post("MIDI (ALSA): could not start input thread\n");
			return errFailed;
		}
	}
Esempio n. 3
0
//initalizes input thread and then starts UCI loop
int main(int argc, char *argv[])
{
  //prepare our hash table
  for (int i = 0; i < FILE_COUNT; i++) {
    for (int j = 0; j < RANK_COUNT; j++) {
      //k represents the enumeration of all possible khetpieces as an int
      //see khetpiece::id()
      for (int k = 0; k < 150; k++) {
        KhetState::zob[i][j][k] = myrand();
      }
    }
  }
  //this will be reading input in the background
  cilk_spawn inputThread();
  ply = 0;
  uci();
  return 0;
}
Esempio n. 4
0
int main()
{
    sf::Thread inputThread(&inputThreadFunc);
    sf::Thread renderThread(&renderThreadFunc);
    sf::Thread logicThread(&logicThreadFunc);

    inputThread.Launch();
    // wait for input thread to create window
    while(!global.windowOpen);
    renderThread.Launch();
    logicThread.Launch();

    inputThread.Wait();
    renderThread.Wait();
    logicThread.Wait();

    global.window->Close();
    delete global.window;

    return EXIT_SUCCESS;
}
Esempio n. 5
0
int main(int argc, char * argv[])
{


	int fd; /* File descriptor for the port */
	int i;
	char out[255], input;
	int status;

	Connection con(argv[1]);

	bool stop = false;
	int connectionDescriptor = con.getConnectionDescriptor();
	DataHandler dh();
	InputHandler inputHandler(connectionDescriptor, &stop);
	boost::thread inputThread(boost::ref(inputHandler));

	
	inputThread.join();

	return 0;
}