Exemplo n.º 1
0
int main ()
{
	initialTimer ();
	initialPWM ();
	initialSpeaker ()
	startAll ();
	while (1);
	return 0;
}
Exemplo n.º 2
0
//#include "mythUdp.hh"
mythStreamMapServer::mythStreamMapServer(int port)
:mythVirtualServer(port)//, mythVirtualSqlite()
{
	char tmpip[256] = { 0 };
	int start = read_profile_int("config", "autostart", 0 , MYTH_INFORMATIONINI_FILE);
	if (start || MYTH_FORCE_AUTOSTART){
		startAll();
	}
	mapmutex = SDL_CreateMutex();
#ifdef MYTH_STREAM_CLOSE
	this->timerid = SDL_AddTimer(1000, TimerCallbackStatic, this);
#endif
}
int DialogScheduler::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QDialog::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: startAll(); break;
        case 1: stopAll(); break;
        case 2: applyAll(); break;
        case 3: apply(); break;
        case 4: start(); break;
        case 5: stop(); break;
        default: ;
        }
        _id -= 6;
    }
    return _id;
}
int main(int argc, char const *argv[])
{
	startAll();
	signal(SIGINT, terminateAll);
	while(runing) {

        ProtoMessage msg = receiveProtobufMessage(name2socket["pod"]);
        string device = msg.dest_device();
        cout << "Waiting on message " << device<< endl;
        if(Name2port.find(device) != Name2port.end()){
        	if( msg.signal() == ProtoMessage::TERMINATE) {
        		cout <<device <<" is terminating"<<endl;
        		terminateDevice(device);
	        	
	        }  else if (msg.signal() == ProtoMessage::RESET){
				resetDevice(device);
			}
        }
    }
    google::protobuf::ShutdownProtobufLibrary();
    cout <<"termination Successful!!"<<endl;
	return 0;
}
Exemplo n.º 5
0
void Perft::run() {

    if (!load()) {
        perftRes.hash = nullptr;
        if (mbSize) {
            alloc();
        }
    }

    if (fen.empty()) {
        fen = STARTPOS;
    }
    if (!perftRes.depth) {
        perftRes.depth = 1;
    }
    if (!perftRes.nCpu) {
        perftRes.nCpu = 1;
    }
    PerftThread *p = new PerftThread();
    if (!fen.empty()) {
        p->loadFen(fen);
    }
    p->setPerft(true);
    int side = p->getSide() ? 1 : 0;
    p->display();
    cout << "fen:\t\t\t" << fen << endl;
    cout << "depth:\t\t\t" << perftRes.depth << endl;
    cout << "#cpu:\t\t\t" << perftRes.nCpu << endl;
    cout << "cache size:\t\t" << mbSize << endl;
    cout << "dump file:\t\t" << dumpFile << endl;
    cout << endl << Time::getLocalTime() << " start perft test..." << endl;

    Timer t2(minutesToDump * 60);
    if (perftRes.hash && !dumpFile.empty()) {
        signal(SIGINT, Perft::ctrlChandler);
        cout << "dump hash table in " << dumpFile << " every " << minutesToDump << " minutes" << endl;
        cout << "type 'dump' to dump now" << endl;
        t2.registerObservers([this]() {
            dump();
        });
        t2.start();
    }

    cout << endl << endl << setw(6) << "move" << setw(20) << "tot";
    cout << setw(8) << "#";
    cout << endl;

    time.resetAndStart();
    p->incListId();
    u64 friends = side ? p->getBitmap<WHITE>() : p->getBitmap<BLACK>();
    u64 enemies = side ? p->getBitmap<BLACK>() : p->getBitmap<WHITE>();
    p->generateCaptures(side, enemies, friends);
    p->generateMoves(side, friends | enemies);
    int listcount = p->getListSize();
    count = listcount;
    delete (p);
    p = nullptr;
    ASSERT(perftRes.nCpu > 0);
    int block = listcount / perftRes.nCpu;
    int i, s = 0;
    setNthread(perftRes.nCpu);
    for (i = 0; i < perftRes.nCpu - 1; i++) {
        PerftThread &perftThread = getNextThread();
        perftThread.setParam(fen, s, s + block, &perftRes);
        s += block;
    }
    PerftThread &perftThread = getNextThread();
    perftThread.setParam(fen, s, listcount, &perftRes);
    startAll();
    joinAll();
}