• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ doWork函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中doWork函数的典型用法代码示例。如果您正苦于以下问题:C++ doWork函数的具体用法?C++ doWork怎么用?C++ doWork使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了doWork函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: TEST_F

TEST_F(DriverConductorNetworkTest, shouldBeAbleToAddAndRemoveSingleNetworkSubscription)
{
    int64_t client_id = nextCorrelationId();
    int64_t sub_id = nextCorrelationId();
    int64_t remove_correlation_id = nextCorrelationId();

    ASSERT_EQ(addNetworkSubscription(client_id, sub_id, CHANNEL_1, STREAM_ID_1, -1), 0);
    doWork();
    EXPECT_EQ(aeron_driver_conductor_num_network_subscriptions(&m_conductor.m_conductor), 1u);
    EXPECT_EQ(readAllBroadcastsFromConductor(null_handler), 1u);

    ASSERT_EQ(removeSubscription(client_id, remove_correlation_id, sub_id), 0);
    doWork();
    auto handler = [&](std::int32_t msgTypeId, AtomicBuffer& buffer, util::index_t offset, util::index_t length)
    {
        ASSERT_EQ(msgTypeId, AERON_RESPONSE_ON_OPERATION_SUCCESS);

        const command::OperationSucceededFlyweight response(buffer, offset);

        EXPECT_EQ(response.correlationId(), remove_correlation_id);
    };

    EXPECT_EQ(aeron_driver_conductor_num_network_subscriptions(&m_conductor.m_conductor), 0u);
    EXPECT_EQ(readAllBroadcastsFromConductor(handler), 1u);
}
开发者ID:real-logic,项目名称:Aeron,代码行数:25,代码来源:aeron_driver_conductor_network_test.cpp


示例2: WinMain

int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int cmdShow)
{
    StringVector sv = Helper::split(lpCmdLine, '-');
    bool minimized = false;
    for (StringVector::iterator itr = sv.begin(); itr != sv.end(); ++ itr)
    {
        if (*itr == "minimized" || *itr == "m")
        {
            minimized = true;
            break;
        }
    }

    if (minimized)
    {
        return doWork();
    }
    else
    {
        if(AllocConsole())
        {
            freopen("CONOUT$", "w", stdout);
            SetConsoleTitle(SERVER_APP_NAME);
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_RED);
        }

        outbuf ob;
        std::streambuf *sb = std::cout.rdbuf(&ob);

        int result = doWork();

        std::cout.rdbuf(sb);
        return result;
    }
}
开发者ID:jkrecek,项目名称:not-only-shutdown-app,代码行数:35,代码来源:main.cpp


示例3: main

int main() {

    int x = 10, y = 50, z = 15, sum, max;
    doWork(x, y, z, &sum, &max);
    printf("Sum = %d, Max = %d\n", sum, max);
    return 0;
}
开发者ID:wdenejko,项目名称:Misc,代码行数:7,代码来源:doWork-pointers.c


示例4: QByteArray

bool BlinkyTapeUploader::upgradeFirmware(int timeout) {
    QByteArray sketch = QByteArray(reinterpret_cast<const char*>(PRODUCTION_DATA),PRODUCTION_LENGTH);

    bootloaderPollTimeout = timeout;

    char buff[BUFF_LENGTH];
    snprintf(buff, BUFF_LENGTH, "Sketch size: %iB",
             sketch.length()),
    qDebug() << buff;

    // The entire sketch must fit into the available memory, minus a single page
    // at the end of flash for the configuration header
    // TODO: Could save ~100 bytes if we let the sketch spill into the unused portion
    // of the header.
    if(sketch.length() > FLASH_MEMORY_AVAILABLE) {
        qDebug() << "sketch can't fit into memory!";

        errorString = QString("Sorry! The Pattern is a bit too big to fit in BlinkyTape memory right now. We're working on improving this! Avaiable space=%1, Pattern size=%2")
                .arg(FLASH_MEMORY_AVAILABLE)
                .arg(sketch.length());
        return false;
    }

    // Put the sketch, pattern, and metadata into the programming queue.
    flashData.push_back(FlashSection(PRODUCTION_ADDRESS, sketch));

    setProgress(0);
    // TODO: Calculate this based on feedback from the programmer.
    setMaxProgress(300);

    stateStartTime = QDateTime::currentDateTime();
    state = State_WaitForBootloaderPort;
    bootloaderResetTimer->singleShot(0,this,SLOT(doWork()));
    return true;
}
开发者ID:Iananan,项目名称:PatternPaint,代码行数:35,代码来源:blinkytapeuploader.cpp


示例5: while

void Parallel::run(int threadIndex)
{
    while (true)
    {
        // Wait for new work in a critical section
        {
            std::unique_lock<std::mutex> lock(_mutex);

            // Indicate that this thread is no longer doing work
            _active[threadIndex] = false;

            // Tell the main thread when all parallel threads are inactive
            if (!threadsActive()) _conditionMain.notify_all();

            // Wait for new work
            while (true)
            {
                _conditionExtra.wait(lock);

                // Check for termination request (don't bother with _active; it's no longer used)
                if (_terminate) return;

                // Check that we actually have new work
                if (_active[threadIndex]) break;
            }
        }

        // Do work as long as some is available
        doWork();
    }
}
开发者ID:djsavic,项目名称:SKIRT,代码行数:31,代码来源:Parallel.cpp


示例6: QMainWindow

//COnstructor
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    //Server object
    ser = new Server();

    //THread for server
    m_thread = new QThread;

    //Connection to signal the server class to start working and checking for messages
    connect(this, SIGNAL(startServer()), ser, SLOT(doWork()));

    //Connection to notify the GUI to update
    connect(ser, SIGNAL(sendText(QString)), this, SLOT(writeText(QString)));

    //Start the thread
    ser->moveToThread(m_thread);
    m_thread->start();

    //Start the server working to check for messages
    emit startServer();
}
开发者ID:skralick,项目名称:ECE3574HW7,代码行数:26,代码来源:mainwindow.cpp


示例7: db2_access

int db2_access(test_req_t *req, test_req_t *resp)
{
	SQLHENV henv;	/* environment handle */
	SQLHDBC hdbc;	/* connection handle */
	SQLRETURN rc = SQL_ERROR;
	SQLHSTMT shdl;

	btlogger_debug("op=%c data=%s db=%s\n", req->op, req->data, req->db);

	if (init(req->db, &henv, &hdbc) != SQL_SUCCESS)
		return (int) rc;

	rc = SQLAllocHandle(SQL_HANDLE_STMT, hdbc, &shdl);

	if ( rc != SQL_SUCCESS ) {
		(void) check_error(SQL_HANDLE_STMT, shdl, rc, "SQLAllocHandle", (SQLCHAR *) "statement handle");
	} else {
		rc = doWork(req->op, req->data, henv, hdbc, shdl, resp);
		(void) SQLFreeStmt(shdl, SQL_DROP);
	}

	fini(henv, hdbc);

	return (int) rc;
}
开发者ID:ALRubinger,项目名称:jbosstm-quickstart,代码行数:25,代码来源:db2.c


示例8: loop

void loop() {

	// do housekeeping
	doWork();

	// character received on serial port? may be a connection attempt
	if (Serial.available() > 0) {

		// indicate connected status
		digitalWrite(13, HIGH);   // set the LED on

		// start the OPDI protocol, passing a pointer to the housekeeping function
		// this call blocks until the slave is disconnected
		uint8_t result = Opdi->start(&doWork);

		// no regular disconnect?
		if (result != OPDI_DISCONNECTED) {
			digitalWrite(13, LOW);    // set the LED off
			delay(500);

			// flash error code on LED
			for (uint8_t i = 0; i < result; i++) {
				digitalWrite(13, HIGH);   // set the LED on
				delay(200);              // wait
				digitalWrite(13, LOW);    // set the LED off
				delay(200);              // wait
			}
		}

		digitalWrite(13, LOW);    // set the LED off
	}
}
开发者ID:leomeyer,项目名称:OPDI,代码行数:32,代码来源:main.cpp


示例9: QObject

HtmlParser::HtmlParser(const QUrl &url, const QString &text, QObject *parent)
    :
      QObject(parent),
      _info(new UrlInfo, [](UrlInfo* p){delete p;}),
      _downloaded(false),
      _text(text),
      _downloader(nullptr)
{
    _info->_url = url.toString();
    _info->_found = false;
    _info->_status = UrlInfo::DOWNLOADING;
    _info->_percentage = 0;
    emit processing(_info.data());
    QThread * thread = new QThread();
    _downloader = new HtmlDownloader(url);
    _downloader->moveToThread(thread);

    connect( thread, SIGNAL(started()), _downloader, SLOT(doWork()));

    connect( _downloader, SIGNAL(finished(QString)), thread, SLOT(quit()));
    connect( _downloader, SIGNAL(finished(QString)), this, SLOT(downloaded(QString)), Qt::ConnectionType::DirectConnection);
    connect(_downloader, SIGNAL(downloadProgress(qint64,qint64)), this, SLOT(downloadProgress(qint64,qint64)));

    connect( thread, SIGNAL(finished()), thread, SLOT(deleteLater()));

    thread->start();
}
开发者ID:Varser,项目名称:HtmlParser,代码行数:27,代码来源:htmlparser.cpp


示例10: doWork

void Worker::onGoFromService (InputParametersRS input)
{
    try {

        doWork( input);

    } catch ( Interrupt & ) {
        // std::cerr << "*** Worker interrupted ***\n";
        dbg(1) << "RS interrupted\n";
        emit interrupt ();
    } catch ( std::runtime_error & e) {
        std::cerr << "Worker runtime-exception: " << e.what() << "\n";
        emit error( QString("runtime-exception: %1").arg(e.what()));
    } catch ( std::exception & e) {
        std::cerr << "Worker std-exception: " << e.what() << "\n";
        emit error( QString("std-exception: %1").arg(e.what()));
    } catch ( std::string & s) {
        std::cerr << "Worker exception: " << s << "\n";
        emit error( QString("exception: %1").arg(s.c_str()));
    } catch ( QString & s) {
        std::cerr << "Worker exception: " << s << "\n";
        emit error( QString("exception: %1").arg(s));
    } catch ( char * s) {
        std::cerr << "Worker exception: " << s << "\n";
        emit error( QString("exception: %1").arg(s));
    } catch (...) {
        std::cerr << "Worker uncaught exception...\n";
        dbg(1) << "Worker uncaught exception\n";
        emit error ( "Uncaught exception");
//        throw;
    }
}
开发者ID:pfederl,项目名称:CARTAvis,代码行数:32,代码来源:RegionStatsService.cpp


示例11: doWork

void OscListenerWorker::Start()
{
    if (!running) {
        running = true;
        doWork();
    }
}
开发者ID:hypebeast,项目名称:OSCShark,代码行数:7,代码来源:osclistenerworker.cpp


示例12: createProc

void createProc(int number, pid_t* pid_array){
	int i = 0;
	pid_t pid;
	int *array;
	
	//Preparing random order squence
	array = (int*)malloc(sizeof(int)*number);

	for(i = 0; i < number; ++i)
		array[i] = i;
	shuffle(array, number);

	unlockSem(0); //aby mohol prvy bezat
	for(i = 0; i < number; ++i){
		switch(pid = fork()){
			case 0:
      			doWork(array[i], getNext(array, i + 1, number));
			exit(EXIT_SUCCESS);
    		case -1:
      			perror("fork");
      			exit(EXIT_FAILURE);
    		default:
				pid_array[i] = pid;
      			break;
		}
	}
	free(array);
}
开发者ID:MichalGallovic,项目名称:systemoveprogramovanie,代码行数:28,代码来源:zadanie_2_01.c


示例13: if

void QuebrarSenha::quebrarSenhaZIP()
{
    QString text = ui->lineEdit->text();

    QThread *workerThread;
    CountWorker *worker;

    int i;
    //Esta é a parte mais importante do programa;
    //Está sendo criado 4 threads, onde cada thread é responsável por executar uma porção das senhas em paralelo
    //As senhas variam de 0 a 500000
    for(i = 0; i < 4; i++){
        workerThread = new QThread;
        QLabel *label;
        if(i==0) label=ui->thread0;
        else if(i==1) label=ui->thread1;
        else if(i==2) label=ui->thread2;
        else if(i==3) label=ui->thread3;

        worker = new CountWorker(i*125000, (i+1)*125000, text, label);
        worker->moveToThread(workerThread);
        connect(workerThread, SIGNAL(started()), worker, SLOT(doWork()));
        connect(worker, SIGNAL(finished()), workerThread, SLOT(quit()));
        connect(worker, SIGNAL(finished()), worker, SLOT(deleteLater()));
        connect(workerThread, SIGNAL(finished()), workerThread, SLOT(deleteLater()));
        connect(worker, SIGNAL(updateCount(int, QLabel*)), this, SLOT(updateCount(int, QLabel*)));
        connect(worker, SIGNAL(updateSenha(int)), this, SLOT(updateSenha(int)));
        connect(worker, SIGNAL(updateProgressBar(float)), this, SLOT(updateProgressBar(float)));

        workerThread->start();
    }
}
开发者ID:rcfsousa,项目名称:Breaking-Password-using-QT,代码行数:32,代码来源:quebrarsenha.cpp


示例14: main

//========
// main()
//========
int main(int argc, char** argv) {
  bool isok = false;
  try {
    Input input(argc, argv);
    doWork(input);
    isok = true;
  } catch(const Help& h) {
    std::cout << prognm << std::endl;
    std::cout << "  citation: " + citation << std::endl;
    std::cout << "  version:  " + version << std::endl;
    std::cout << "  authors:  " + authors << std::endl;
    std::cout << usage() << std::endl;
    isok = true;
  } catch(const Version& v) {
    std::cout << prognm << std::endl;
    std::cout << "  citation: " + citation << std::endl;
    std::cout << "  version:  " + version << std::endl;
    std::cout << "  authors:  " + authors << std::endl;
    isok = true;
  } catch(std::string& msg) {
    std::cerr << prognm << std::endl;
    std::cerr << "  citation: " + citation << std::endl;
    std::cerr << "  version:  " + version << std::endl;
    std::cerr << "  authors:  " + authors << std::endl;
    std::cerr << usage() << std::endl;
    std::cerr << msg << std::endl;
  } catch(std::exception& e) {
    std::cerr << usage() << std::endl;
    std::cerr << e.what() << std::endl;
  } catch(...) {
    std::cerr << usage() << std::endl;
    std::cerr << "Unknown Error.  Aborting" << std::endl;
  }
  return(isok ? EXIT_SUCCESS : EXIT_FAILURE);
}
开发者ID:Antisunny,项目名称:bedops,代码行数:38,代码来源:ExtractRows.cpp


示例15: doWork

void Compute::receiveB(int indexX, float *data, int size) {
  for(int j=0; j<subBlockDimYx; j++)
    for(int k=0; k<blockDimZ; k++)
      B[indexX*subBlockDimYx*blockDimZ + j*blockDimZ + k] = data[j*blockDimZ + k];
  countB++;
  if(countA == num_chare_z-1 && countB == num_chare_x-1)
    doWork();
}
开发者ID:brog2610,项目名称:quinoa,代码行数:8,代码来源:matmul3d.C


示例16: reload

Scheduler::Scheduler()
{
	reload();

	connect(&m_timer, SIGNAL(timeout()), this, SLOT(doWork()));
	m_timer.start(60*1000);
	m_instance = this;
}
开发者ID:ActionLuzifer,项目名称:fatrat,代码行数:8,代码来源:Scheduler.cpp


示例17: assert

void SFTWorker::run()
{
	assert(m_pCT);

	while (true)
	{
		uint32 status = m_pCT->getStatus(m_uiId);
		int32 res = BZ_OK;

		while (status == BaseMCFThread::SF_STATUS_PAUSE)
		{
			gcSleep(500);
			status = m_pCT->getStatus(m_uiId);
		}

		if (status == BaseMCFThread::SF_STATUS_STOP)
		{
			break;
		}
		else if (status == BaseMCFThread::SF_STATUS_NULL)
		{
			if (!newTask())
				gcSleep(500);

			continue;
		}
		else if (status == BaseMCFThread::SF_STATUS_ENDFILE)
		{
			do
			{
				res = doWork();
				if (bzErrorCheck(res))
					break;
			}
			while (res != BZ_STREAM_END);
		}
		else if (status == BaseMCFThread::SF_STATUS_CONTINUE)
		{
			res = doWork();
			bzErrorCheck(res);
		}

		if (res == BZ_STREAM_END || status == BaseMCFThread::SF_STATUS_SKIP)
			finishFile();
	}
}
开发者ID:callumlinden,项目名称:desura-app,代码行数:46,代码来源:SFTWorker.cpp


示例18: main

int main (int argc, char** argv) {

  MPI_Init (&argc, &argv);

  int numprocs;
  MPI_Comm_size (MPI_COMM_WORLD, &numprocs);

  int myid;
  MPI_Comm_rank (MPI_COMM_WORLD, &myid);
  
  printf ("Hello World from processor: %d out of %d\n", myid, numprocs);

  int namelen;
  char myname[MPI_MAX_PROCESSOR_NAME];
  MPI_Get_processor_name (myname, &namelen);
  printf ("processor id=%d, name=%s\n", myid, myname);

  double time = MPI_Wtime ();

  double d = doWork (1e7);

  time = MPI_Wtime() - time;

  printf ("Time taken by proc = %d is = %g\n", myid, time);

  printf("processor %d sending its time to proc 0\n", myid);
  MPI_Send (&time, 1, MPI_DOUBLE, 0, myid, MPI_COMM_WORLD);

  double totalTime = 0;
  double recvTime;
  if (myid == 0) { 
    int i;
    MPI_Status status;
    for (i = 0; i < numprocs; ++i) {
      MPI_Recv (&recvTime, 1, MPI_DOUBLE, i, i, MPI_COMM_WORLD, &status);
      totalTime += recvTime;
      printf ("received time = %g from proc = %d\n", recvTime, i);
    }

    printf ("time taken, total = %g, avg=%g\n", totalTime, (totalTime/numprocs));

    // proc 0 sends the average time to everyone
    double avgTime = totalTime / numprocs;
    for (i = 0; i < numprocs; ++i) {
      printf ("Proc 0 sending avgTime to proc = %d\n", i);
      MPI_Send (&avgTime, 1, MPI_DOUBLE, i, i, MPI_COMM_WORLD);
    }
  } // end if proc 0

  double avgTime;
  MPI_Status status;
  MPI_Recv (&avgTime, 1, MPI_DOUBLE, 0, myid, MPI_COMM_WORLD, &status);

  printf ("Proc = %d received average time = %g, from proc 0\n", myid, avgTime);

  MPI_Finalize ();
  
}
开发者ID:amberhassaan,项目名称:mpiLearn,代码行数:58,代码来源:naiveBcastReduce.c


示例19: QObject

PingThread::PingThread(QObject * const parent, QString *host) : QObject(parent), 
    process(NULL), timer(new QTimer(this)), host(*host)
{
  this->lastPing = std::numeric_limits<float>::quiet_NaN();
  startProcess();
  connect(timer, SIGNAL(timeout()), this, SLOT(doWork()));
  timer->start(1000);
  qDebug() << "thread started";
}
开发者ID:arran4,项目名称:kping-plasmoid,代码行数:9,代码来源:pingthread.cpp


示例20: qt_affinity_set

void *rcrtoolDaemon(void* arg) {
    qthread_worker_t   *me_worker = (qthread_worker_t *)(swinfo.worker);
    qthread_shepherd_t *me        = (qthread_shepherd_t *)me_worker->shepherd;
    if (swinfo.qaffinity && (me->node != -1)) {
      qt_affinity_set(me_worker,swinfo.nworkerspershep);
    }
    doWork(swinfo.nshepherds, swinfo.nworkerspershep);
    return 0;
}
开发者ID:Agobin,项目名称:chapel,代码行数:9,代码来源:qt_rcrtool.c



注:本文中的doWork函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ doWrite函数代码示例发布时间:2022-05-30
下一篇:
C++ doUpdate函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap