当前位置: 首页>>代码示例>>C++>>正文


C++ doWork函数代码示例

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


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


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