bool WinWindow::onCommand(WPARAM handle, LPARAM lParam)
{
    switch(handle)
    {
        case BTN_SAVE:
            doSave();
            break;
        case BTN_RUN_WIN:
            doRun(false);
            break;
        case BTN_RUN_SERVICE:
            doRun(true);
            break;
        case BTN_RUN_START:
            doRunOnStart();
            break;
        case BTN_QUIT:
            DestroyWindow(m_window);
            break;
        case BTN_KILL:
            doTerminateAll();
            break;
        default:
            return false;
    }

    return true;
}
Esempio n. 2
0
void VMsgLog::connectTimer( WTimer* timer, DWORD )
{
    const char* err = "Unable to connect to batch server.";
    if( !_batserv ) {
#ifdef __WINDOWS__
        _serverConnected = ( VxDConnect() != 0 );
#endif
    } else {
        err = BatchLink( NULL );
        if( !err ) {
            _serverConnected = TRUE;
        }
    }
    if( _serverConnected ) {
        timer->stop();
        _connecting = FALSE;
        if( _runQueued ) {
            _runQueued = FALSE;
            doRun();
        }
    } else if( _connectionTries == 0 ) {
        timer->stop();
        _connecting = FALSE;
        WMessageDialog::info( this, err );
        _parent->deleteMsglog();
        //zombie code at this point!!!!!!!!!!!!!!
    } else {
        _connectionTries -= 1;
    }
}
Esempio n. 3
0
//------------------------------------------------------------------------------
//!
void
Test::run( Result& result )
{
   //printf( (const char*)_indent );
   printf( _fmtName.cstr(), name().cstr() );
   //printf( ":" );
   fflush( stdout );
   doRun( result );
   uint tot = result.total();
   //printf( " " );
   printf( _fmtResRatio.cstr(), result.successes(), tot );
   //printf( " " );
   if( tot != 0 )
   {
      double rate = 100.0 * result.successes()/tot;
      printf( _fmtResPercent.cstr(), rate );
   }
   else
   {
      printf( "%s", _fmtResEmpty.cstr() );
   }
   if( result.failures() != 0 )
   {
      printf( " %d failures", result.failures() );
   }
   printf( "\n" );
   result.printFailureInfos();
   fflush( stdout );
}
Esempio n. 4
0
bool
Pass::run(Function *func, bool ordered, bool skipPhi)
{
   prog = func->getProgram();
   err = false;
   return doRun(func, ordered, skipPhi);
}
Esempio n. 5
0
bool HttpServlet::doRun(const char* memcached_addr /* = "127.0.0.1:11211" */,
	socket_stream* stream /* = NULL */,
	bool body_parse /* = true */, int body_limit /* = 102400 */)
{
	memcache_session session(memcached_addr);
	return doRun(session, stream, body_parse, body_limit);
}
Esempio n. 6
0
bool
Pass::run(Program *prog, bool ordered, bool skipPhi)
{
   this->prog = prog;
   err = false;
   return doRun(prog, ordered, skipPhi);
}
Esempio n. 7
0
void
DhtRunner::run(const sockaddr_in* local4, const sockaddr_in6* local6, const crypto::Identity identity, bool threaded, StatusCallback cb)
{
    if (running)
        return;
    if (rcv_thread.joinable())
        rcv_thread.join();
    statusCb = cb;
    running = true;
    doRun(local4, local6, identity);
    if (not threaded)
        return;
    dht_thread = std::thread([this]() {
        while (running) {
            std::unique_lock<std::mutex> lk(dht_mtx);
            auto wakeup = loop_();
            cv.wait_until(lk, wakeup, [this]() {
                if (not running) 
                    return true;
                {
                    std::lock_guard<std::mutex> lck(sock_mtx);
                    if (not rcv.empty())
                        return true;
                }
                {
                    std::lock_guard<std::mutex> lck(storage_mtx);
                    if (not pending_ops.empty())
                        return true;
                }
                return false;
            });
        }
    });
}
Esempio n. 8
0
 virtual void operator() ()
 {
   mStarted = true;
   if (!mCancelled)
     doRun();
   finish(true);
 }
Esempio n. 9
0
bool IModule::Frame()
{
  if (!m_isinit || m_isexit)
    return false;
  else
    return doRun();
}
Esempio n. 10
0
void
DhtRunner::run(const sockaddr_in* local4, const sockaddr_in6* local6, DhtRunner::Config config)
{
    if (running)
        return;
    if (rcv_thread.joinable())
        rcv_thread.join();
    running = true;
    doRun(local4, local6, config.dht_config);
    if (not config.threaded)
        return;
    dht_thread = std::thread([this]() {
        while (running) {
            std::unique_lock<std::mutex> lk(dht_mtx);
            auto wakeup = loop_();
            cv.wait_until(lk, wakeup, [this]() {
                if (not running) 
                    return true;
                {
                    std::lock_guard<std::mutex> lck(sock_mtx);
                    if (not rcv.empty())
                        return true;
                }
                {
                    std::lock_guard<std::mutex> lck(storage_mtx);
                    if (not pending_ops.empty())
                        return true;
                }
                return false;
            });
        }
    });
}
Esempio n. 11
0
void generateRun(int thread, int startMode, bool doUpgrades, bool doNonBlock)
{
        if (thread == nProcs) {
                doRun();
                return;
        }

        testPerProc_t *pls = PERPROC(&procs[thread]);

        for (int mode1 = startMode; mode1 < NUM_MODES; ++mode1) {
                pls->testMode1 = mode1;
                pls->testMode1DontWait = false;
                pls->testMode2 = -1;
                pls->testMode2DontWait = false;
                generateRun(thread + 1, mode1, doUpgrades, doNonBlock);
                if (doNonBlock) {
                        pls->testMode1DontWait = true;
                        generateRun(thread + 1, mode1, doUpgrades, doNonBlock);
                        pls->testMode1DontWait = false;
                }
                if (doUpgrades) {
                        for (int mode2 = 0; mode2 < NUM_MODES; ++mode2) {
                                if (mode1 == mode2)
                                        continue;
                                pls->testMode2 = mode2;
                                generateRun(thread + 1, mode1, doUpgrades, doNonBlock);
                                if (doNonBlock) {
                                        pls->testMode2DontWait = true;
                                        generateRun(thread + 1, mode1, doUpgrades, doNonBlock);
                                        pls->testMode2DontWait = false;
                                }
                        }
                }
        }
}
Esempio n. 12
0
int NestedCommandLineApp::run(const std::vector<std::string>& args) {
  int status;
  try {
    doRun(args);
    status = 0;
  } catch (const ProgramExit& ex) {
    if (ex.what()[0]) {  // if not empty
      fprintf(stderr, "%s\n", ex.what());
    }
    status = ex.status();
  } catch (const po::error& ex) {
    fprintf(stderr, "%s. Run `%s help' for help.\n",
            ex.what(), programName_.c_str());
    status = 1;
  }

  if (status == 0) {
    if (ferror(stdout)) {
      fprintf(stderr, "error on standard output\n");
      status = 1;
    } else if (fflush(stdout)) {
      fprintf(stderr, "standard output flush failed: %s\n",
              errnoStr(errno).c_str());
      status = 1;
    }
  }

  return status;
}
Esempio n. 13
0
 int BSONTool::run(){
     _objcheck = hasParam( "objcheck" );
     
     if ( hasParam( "filter" ) )
         _matcher.reset( new Matcher( fromjson( getParam( "filter" ) ) ) );
     
     return doRun();
 }
Esempio n. 14
0
bool HttpServlet::doRun()
{
	bool ret = doRun(dbuf_);

	// 重置内存池状态
	dbuf_->dbuf_reset(reserve_size_);
	return ret;
}
Esempio n. 15
0
    int BSONTool::run() {

        if (bsonToolGlobalParams.hasFilter) {
            _matcher.reset(new Matcher(fromjson(bsonToolGlobalParams.filter)));
        }

        return doRun();
    }
Esempio n. 16
0
    int BSONTool::run() {

        if (bsonToolGlobalParams.hasFilter) {
            _matcher.reset(new Matcher(fromjson(bsonToolGlobalParams.filter),
                                       MatchExpressionParser::WhereCallback()));
        }

        return doRun();
    }
Esempio n. 17
0
void WEXPORT VMsgLog::runCommand( const char* cmd )
{
    _command = cmd;
    if( _serverConnected ) {
        clearData();
        doRun();
    } else {
        _runQueued = TRUE;
    }
}
Esempio n. 18
0
 // Schedule process
 // return true to indicate the server will keep running
 // return false to indicate the server stops running
 bool Server::run()
 {        
     Mutex::Lock lock(_mutex);
     if(!_running)
     {
         return false;
     }
     
     return doRun();
 }
Esempio n. 19
0
	void Experiment::run() {
		time(&start);
		LOG << "Start " << _name << ":" << _description;
		doRun();
		if (ofile.is_open()) {
			ofile << std::endl;
			ofile.close();
		}
		LOG << "Complete " << _name << std::endl;
	}
Esempio n. 20
0
File: tool.cpp Progetto: Ecako/mongo
    int BSONTool::run() {
        if ( hasParam( "objcheck" ) )
            _objcheck = true;
        else if ( hasParam( "noobjcheck" ) )
            _objcheck = false;

        if ( hasParam( "filter" ) )
            _matcher.reset( new Matcher( fromjson( getParam( "filter" ) ) ) );

        return doRun();
    }
Esempio n. 21
0
bool
Pass::doRun(Program *prog, bool ordered, bool skipPhi)
{
   for (IteratorRef it = prog->calls.iteratorDFS(false);
        !it->end(); it->next()) {
      Graph::Node *n = reinterpret_cast<Graph::Node *>(it->get());
      if (!doRun(Function::get(n), ordered, skipPhi))
         return false;
   }
   return !err;
}
Esempio n. 22
0
bool JudgeTask::run()
{
    doRun();

    if(!doClean())
    {
        return false;//致命错误
    }

    return true;
}
Esempio n. 23
0
void MainWindow::on_lineEdit_textChanged(const QString &arg1)
{
    if (!ui->pushButton_59->isChecked() || arg1.size() == 0) {
        // Do nothing
        return;
    }
    else
    {
        doRun(arg1);
    }
}
Esempio n. 24
0
void SolveThread::run()
{
	setPriority(QThread::LowPriority);
    init();

	emit slvProgUpdated(SHINT_START, 0);

    doRun(-1);

	emit slvProgUpdated(SHINT_STOP, 0);

}
Esempio n. 25
0
	void run()
	{
		doRun();

		{
			LockMutex m(mutex);

			done_ = true;
			TL_WRITE_SYNC();

			SDL_CondSignal(stateCond);
		}
	}
Esempio n. 26
0
/* ------------------------------------------------------------------ run --- */
int RVB::run()
{
	double rvbsig[2][8192];

	// number of samples to process this time through

	const int frames = framesToRun();
    const int rsamps = frames * 2;

    rtgetin(in, this, rsamps);

	register float *outptr = &this->outbuf[0];
	/* run summed 1st and 2nd generation paths through reverberator */
 	for (int n = 0; n < frames; n++) {
		if (--_branch <= 0) {
			double p[4];
			update(p, 4);
			m_amp = p[3];
			_branch = _skip;
		}
		if (m_amp != 0.0) {
			double rmPair[2];
			double rvbPair[2];
			rmPair[0] = globalReverbInput[0][n];
			rmPair[1] = globalReverbInput[1][n];
			doRun(rmPair, rvbPair, currentFrame() + n);
			rvbsig[0][n] = rvbPair[0] * m_amp;
			rvbsig[1][n] = rvbPair[1] * m_amp;
		}
		else
			rvbsig[0][n] = rvbsig[1][n] = 0.0;
		/* sum the direct signal, early response & reverbed sigs  */
		*outptr++ = in[n*2] + globalEarlyResponse[0][n] + rvbsig[0][n];
		*outptr++ = in[n*2+1] + globalEarlyResponse[1][n] + rvbsig[1][n];
	}
	increment(frames);
	
	// Zero out global buffers for next cycle.
	for (int c = 0; c < 2; ++c) {
		memset(globalReverbInput[c], 0, sizeof(double) * RTBUFSAMPS);
		memset(globalEarlyResponse[c], 0, sizeof(double) * RTBUFSAMPS);
	}
	
	DBG(printf("FINAL MIX:\n"));
	DBG(PrintInput(&this->outbuf[i], bufsamps));
	
	return frames;
}
Esempio n. 27
0
bool http_servlet::run(void)
{
	if (read_body_ == false)
		return doRun();
	else if (req_ == NULL)
	{
		logger_error("req_ null");
		return false;
	}
	else if (res_ == NULL)
	{
		logger_error("res_ null");
		return false;
	}
	else
		return doBody(*req_, *res_);
}
Esempio n. 28
0
void BaseItemTask::doTask()
{
	if (!m_pWebCore || !m_pUserCore)
	{
		gcException e(ERR_BADCLASS);
		onErrorEvent(e);
		return;
	}

	try
	{
		doRun();
	}
	catch (gcException& e)
	{
		onErrorEvent(e);
	}
}
Esempio n. 29
0
void
setupAndRun(void)
{
    CFMutableDictionaryRef hidMatchDictionary = NULL;
    io_service_t           hidService = (io_service_t)0;
    io_object_t            hidDevice = (io_object_t)0;
    IOHIDDeviceInterface **hidDeviceInterface = NULL;
    IOReturn               ioReturnValue = kIOReturnSuccess;
    cookie_struct_t        cookies;
    
    hidMatchDictionary = IOServiceNameMatching("AppleIRController");
    hidService = IOServiceGetMatchingService(kIOMasterPortDefault,
                                             hidMatchDictionary);

    if (!hidService) {
        fprintf(stderr, "Apple Infrared Remote not found.\n");
        exit(1);
    }

    hidDevice = (io_object_t)hidService;

    createHIDDeviceInterface(hidDevice, &hidDeviceInterface);
    cookies = getHIDCookies((IOHIDDeviceInterface122 **)hidDeviceInterface);
    ioReturnValue = IOObjectRelease(hidDevice);
    print_errmsg_if_io_err(ioReturnValue, "Failed to release HID.");

    if (hidDeviceInterface == NULL) {
        fprintf(stderr, "No HID.\n");
        exit(1);
    }

    ioReturnValue = (*hidDeviceInterface)->open(hidDeviceInterface, 0);

    doRun(hidDeviceInterface, cookies);

    if (ioReturnValue == KERN_SUCCESS)
        ioReturnValue = (*hidDeviceInterface)->close(hidDeviceInterface);

    (*hidDeviceInterface)->Release(hidDeviceInterface);
}
Esempio n. 30
0
/* ------------------------------------------------------------------ run --- */
int RVB::run()
{
	double rvbsig[2][8192];
	const int frames = framesToRun();
	const int inChans = inputChannels();

    rtgetin(in, this, frames * inChans);

	register float *outptr = &this->outbuf[0];
	/* run summed 1st and 2nd generation paths through reverberator */
 	for (int n = 0; n < frames; n++) {
		if (--_branch <= 0) {
			double p[4];
			update(p, 4);
			m_amp = p[3];
			_branch = getSkip();
		}
		if (m_amp != 0.0) {
			double rmPair[2];
			double rvbPair[2];
			rmPair[0] = in[n*inChans+2];
			rmPair[1] = in[n*inChans+3];
			doRun(rmPair, rvbPair, currentFrame() + n);
			rvbsig[0][n] = rvbPair[0] * m_amp;
			rvbsig[1][n] = rvbPair[1] * m_amp;
		}
		else
			rvbsig[0][n] = rvbsig[1][n] = 0.0;
		/* sum the input signal (which includes early response) & reverbed sigs  */
		*outptr++ = in[n*inChans] + rvbsig[0][n];
		*outptr++ = in[n*inChans+1] + rvbsig[1][n];
	}
	increment(frames);
		
	DBG(printf("FINAL MIX:\n"));
	DBG(PrintInput(&this->outbuf[0], RTBUFSAMPS));
	DBG(PrintInput(&this->outbuf[1], RTBUFSAMPS));
	
	return frames;
}