这篇教程C++ threadShouldExit函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中threadShouldExit函数的典型用法代码示例。如果您正苦于以下问题:C++ threadShouldExit函数的具体用法?C++ threadShouldExit怎么用?C++ threadShouldExit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了threadShouldExit函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: _MM_SET_DENORMALS_ZERO_MODEvoid TimeLagFilterCore::DTCalcThread::run(){ //Disable denormalized floats _MM_SET_DENORMALS_ZERO_MODE(_MM_DENORMALS_ZERO_ON); _MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON); //Start float b, c; while(!threadShouldExit()){ if(!core.paramsChanged) wait(-1); if(threadShouldExit()) return; if(core.sampleSwapDT){ //Don't recalculate if waiting for sample to finish wait(1); //Try again soon }else{ //Copy write to calc { const ScopedWriteLock writeLock(core.ctLock); memcpy(core.ct_calc, core.ct_write, core.num_filters * sizeof (CTParams)); core.paramsChanged = false; } //Calculate filter coefficients const ScopedWriteLock writeLock(core.dtLock); for(int i=0; i<core.num_filters; ++i){ filtercalculations(core.reduced_fs, core.ct_calc[i].center, core.ct_calc[i].bw, &b, &c); core.dt_calc[i].b = b; core.dt_calc[i].c = c; } core.sampleSwapDT = true; } }}
开发者ID:sauraen,项目名称:timelagfilter,代码行数:30,
示例2: run void run() { uint32 lastTime = Time::getMillisecondCounter(); MessageManager::MessageBase::Ptr messageToSend (new CallTimersMessage()); while (! threadShouldExit()) { const uint32 now = Time::getMillisecondCounter(); if (now == lastTime) { wait (1); continue; } std::cout << "MPD: TIMER THREAD: " << now << std::endl; const int elapsed = (int) (now >= lastTime ? (now - lastTime) : (std::numeric_limits<uint32>::max() - (lastTime - now))); lastTime = now; const int timeUntilFirstTimer = getTimeUntilFirstTimer (elapsed); if (timeUntilFirstTimer <= 0) { /* If we managed to set the atomic boolean to true then send a message, this is needed as a memory barrier so the message won't be sent before callbackNeeded is set to true, but if it fails it means the message-thread changed the value from under us so at least some processing is happenening and we can just loop around and try again */ if (callbackNeeded.compareAndSetBool (1, 0)) { messageToSend->post(); /* Sometimes our message can get discarded by the OS (e.g. when running as an RTAS when the app has a modal loop), so this is how long to wait before assuming the message has been lost and trying again. */ const uint32 messageDeliveryTimeout = now + 2000; while (callbackNeeded.get() != 0) { wait (4); if (threadShouldExit()) return; if (Time::getMillisecondCounter() > messageDeliveryTimeout) break; } } } else { // don't wait for too long because running this loop also helps keep the // Time::getApproximateMillisecondTimer value stay up-to-date wait (jlimit (1, 50, timeUntilFirstTimer)); } } }
开发者ID:zenAudio,项目名称:beatmatic-xcode,代码行数:60,
示例3: run void run() { for (int i = 0; i < itemsToInstall.size(); ++i) { const ModuleList::Module* m = list.findModuleInfo (itemsToInstall[i]); jassert (m != nullptr); if (m != nullptr) { setProgress (i / (double) itemsToInstall.size()); MemoryBlock downloaded; result = download (*m, downloaded); if (result.failed()) break; if (threadShouldExit()) break; result = unzip (*m, downloaded); if (result.failed()) break; } if (threadShouldExit()) break; } }
开发者ID:HsienYu,项目名称:JUCE,代码行数:30,
示例4: whilevoid LR_IPC_IN::run(){ while (!threadShouldExit()) { char line[256] = { '/0' }; int sizeRead = 0; bool canReadLine = true; // parse input until we have a line, then process that line while (!String(line).endsWithChar('/n') && !threadShouldExit()) { auto waitStatus = waitUntilReady(true, 0); if (waitStatus < 0) { canReadLine = false; break; } else if (waitStatus == 0) { wait(100); continue; } sizeRead += read(line + sizeRead, 1, false); } if (canReadLine) { String param(line); processLine(param); } }}
开发者ID:Jewest,项目名称:MIDI2LR,代码行数:32,
示例5: run void run() { const int bufferSize = currentBufferSizeSamples; HANDLE events[2]; int numEvents = 0; if (inputDevice != 0) events [numEvents++] = inputDevice->clientEvent; if (outputDevice != 0) events [numEvents++] = outputDevice->clientEvent; const int numInputBuffers = getActiveInputChannels().countNumberOfSetBits(); const int numOutputBuffers = getActiveOutputChannels().countNumberOfSetBits(); AudioSampleBuffer ins (jmax (1, numInputBuffers), bufferSize + 32); AudioSampleBuffer outs (jmax (1, numOutputBuffers), bufferSize + 32); float** const inputBuffers = ins.getArrayOfChannels(); float** const outputBuffers = outs.getArrayOfChannels(); ins.clear(); while (! threadShouldExit()) { const DWORD result = WaitForMultipleObjects (numEvents, events, true, 1000); if (result == WAIT_TIMEOUT) continue; if (threadShouldExit()) break; if (inputDevice != 0) inputDevice->copyBuffers (inputBuffers, numInputBuffers, bufferSize, *this); // Make the callback.. { const ScopedLock sl (startStopLock); if (isStarted) { JUCE_TRY { callback->audioDeviceIOCallback ((const float**) inputBuffers, numInputBuffers, outputBuffers, numOutputBuffers, bufferSize); } JUCE_CATCH_EXCEPTION } else { outs.clear(); } } if (outputDevice != 0) outputDevice->copyBuffers ((const float**) outputBuffers, numOutputBuffers, bufferSize, *this); }
开发者ID:alessandropetrolati,项目名称:juced,代码行数:58,
示例6: startTimervoid ThorUpdateThread::run(){ startTimer (5000); Logger::writeToLog (T("check for updates")); updateUrl = new URL(config->getVersionUrl() + T("/thor.md5")); if (threadShouldExit()) { deleteAndZero (updateUrl); return; } String md5 = updateUrl->readEntireTextStream(); if (threadShouldExit()) { deleteAndZero (updateUrl); return; } if (!md5.isEmpty()) { File exe = File::getSpecialLocation(File::currentExecutableFile); MD5 thorMD5 (exe); if (threadShouldExit()) { deleteAndZero (updateUrl); return; } String remoteMd5 = md5.upToFirstOccurrenceOf (T(" "), false, true).toLowerCase(); String localMd5 = thorMD5.toHexString(); if (threadShouldExit()) { deleteAndZero (updateUrl); return; } if (localMd5 != remoteMd5) { AlertWindow::showMessageBox (AlertWindow::InfoIcon, T("Update"), T("New version of Thor available"), T("Ok")); } if (threadShouldExit()) { deleteAndZero (updateUrl); return; } } deleteAndZero (updateUrl); return;}
开发者ID:bergsail,项目名称:thor-v2,代码行数:56,
示例7: whilevoid MidiOutput::run(){ while (! threadShouldExit()) { uint32 now = Time::getMillisecondCounter(); uint32 eventTime = 0; uint32 timeToWait = 500; PendingMessage* message; { const ScopedLock sl (lock); message = firstMessage; if (message != nullptr) { eventTime = (uint32) roundToInt (message->message.getTimeStamp()); if (eventTime > now + 20) { timeToWait = eventTime - (now + 20); message = nullptr; } else { firstMessage = message->next; } } } if (message != nullptr) { const ScopedPointer<PendingMessage> messageDeleter (message); if (eventTime > now) { Time::waitForMillisecondCounter (eventTime); if (threadShouldExit()) break; } if (eventTime > now - 200) sendMessageNow (message->message); } else { jassert (timeToWait < 1000 * 30); wait ((int) timeToWait); } } clearAllPendingMessages();}
开发者ID:owenvallis,项目名称:Nomestate,代码行数:54,
示例8: isvoid CtrlrFileDownloader::run(){ ScopedPointer <InputStream> is (fileToDownload.createInputStream (false)); const int totalLength = is->getTotalLength(); int bytesSoFar = 0; const String packageFile = CtrlrUpdateManager::getMyPackage(); if (outputFile.exists()) { outputFile.deleteFile(); outputFile.create(); } while (! (is->isExhausted())) { if (threadShouldExit()) { return; } MemoryBlock buffer(8192); const int num = is->read (buffer.getData(), 8192); if (num == 0) break; bytesSoFar += num; outputFile.appendData(buffer.getData(), buffer.getSize()); setStatusMessage ("File: " + packageFile + "/nTotal size: " + File::descriptionOfSizeInBytes (totalLength) + " Got size: " + File::descriptionOfSizeInBytes (bytesSoFar)); setProgress (bytesSoFar / (double)totalLength); }}
开发者ID:Srikrishna31,项目名称:ctrlr,代码行数:33,
示例9: run void run() { if (recorder != nullptr) recorder->start(); if (player != nullptr) player->start(); while (! threadShouldExit()) { if (player != nullptr) player->writeBuffer (outputBuffer, *this); if (recorder != nullptr) recorder->readNextBlock (inputBuffer, *this); const ScopedLock sl (callbackLock); if (callback != nullptr) { callback->audioDeviceIOCallback (numInputChannels > 0 ? (const float**) inputBuffer.getArrayOfChannels() : nullptr, numInputChannels, numOutputChannels > 0 ? outputBuffer.getArrayOfChannels() : nullptr, numOutputChannels, actualBufferSize); } else { outputBuffer.clear(); } } }
开发者ID:oeberhard,项目名称:BAVSN,代码行数:26,
示例10: whilevoid BenderDataCollector::run(){ float magnetData[3], accelData[3]; while (!threadShouldExit()) { { ScopedWriteLock sl(statusDataLock); benderStatus.currentTimeMillis = (double)Time::getCurrentTime().currentTimeMillis();#ifdef LINUX if (collectNetworkData) { benderNetworkDataCollector.collect(); } XLoReadAccelerometer(accelData); XLoReadCompassRaw(magnetData); benderStatus.temperature = XLoReadTemperature(); benderStatus.magnetometerData[0] = magnetData[0]; benderStatus.magnetometerData[1] = magnetData[1]; benderStatus.magnetometerData[2] = magnetData[2]; benderStatus.accelerometerData[0] = accelData[0]; benderStatus.accelerometerData[1] = accelData[0]; benderStatus.accelerometerData[2] = accelData[0]; //_DBG ("mX: ["+String(magnetData[0],4)+"] mY: ["+String(magnetData[1],4)+"] mZ: ["+String(magnetData[2],4)+"]");#endif } sleep (samplingInterval); }}
开发者ID:RomanKubiak,项目名称:bender,代码行数:34,
示例11: DBGvoid MapperInterface::run(){ DBG("starting mapper interface thread.../n"); while (!threadShouldExit()) { //do stuff here... int idx=0; if (myMapperOut != NULL) { myMapperOut->poll(); for (int i=0; i<kNUM_ICUBEX_SENSORS; i++) { String signame = "/sensor" + String(i); int sensorVal = mySigVals.at(idx); //note: we assume this signal exists, which may not be the case! myMapperOut->signal(signame.toStdString()).update(sensorVal); } sleep(50); //lets not be too hasty here... } } if (myMapperOut != NULL) { delete myMapperOut; } DBG("ending mapper interface thread.../n");}
开发者ID:johnty,项目名称:ICubeX-mapper-juce,代码行数:28,
示例12: run void run() { int n = 0; while (! threadShouldExit()) { int num = Random::getSystemRandom().nextInt (2000) + 1; int start1, size1, start2, size2; fifo.prepareToWrite (num, start1, size1, start2, size2); jassert (size1 >= 0 && size2 >= 0); jassert (size1 == 0 || (start1 >= 0 && start1 < fifo.getTotalSize())); jassert (size2 == 0 || (start2 >= 0 && start2 < fifo.getTotalSize())); int i; for (i = 0; i < size1; ++i) buffer [start1 + i] = n++; for (i = 0; i < size2; ++i) buffer [start2 + i] = n++; fifo.finishedWrite (size1 + size2); } }
开发者ID:baeksanchang,项目名称:juce,代码行数:25,
示例13: whilevoid EdoGaduLog::run(){ if (!checkSchema()) { Logger::writeToLog (T("EdoGaduLog::run schema is invalid, can't log")); return; } else { Logger::writeToLog (T("EdoGaduLog::run schema created or is valid")); } while (1) { wait (1000); if (threadShouldExit()) { flushBuffers(); return; } flushBuffers(); }}
开发者ID:orisha85,项目名称:edoapp,代码行数:25,
示例14: run //============================================================================== void run() { { // Allow the message thread to finish setting-up the context before using it.. MessageManagerLock mml (this); if (! mml.lockWasGained()) return; } nativeContext->makeActive(); initialiseOnThread(); #if JUCE_USE_OPENGL_SHADERS && ! JUCE_OPENGL_ES shadersAvailable = OpenGLShaderProgram::getLanguageVersion() > 0; #endif while (! threadShouldExit()) { const uint32 frameRenderStartTime = Time::getMillisecondCounter(); if (renderFrame()) waitForNextFrame (frameRenderStartTime); } shutdownOnThread(); }
开发者ID:sonic59,项目名称:JuceDirect2D,代码行数:27,
示例15: whilevoid Gsp1101::run(){ double prog = 0.0; AlertWindow* alertWindow; { const MessageManagerLock mml ;//(Thread::getCurrentThread()); alertWindow = LookAndFeel::getDefaultLookAndFeel() .createAlertWindow ("title", String::empty, String::empty, String::empty, String::empty, AlertWindow::NoIcon, 0, 0); alertWindow->addProgressBarComponent (prog); alertWindow->setMessage ("foo"); alertWindow->setVisible (true); } while (!threadShouldExit() && lastMidiInput_M.getSize() < 1) { wait(200); const MessageManagerLock mml (Thread::getCurrentThread()); if (! mml.lockWasGained()) // if something is trying to kill this job, the lock return; // will fail, in which case we'd better return.. prog = (prog > 1.0) ? 0.0 : prog + 0.1; yield(); //Thread::sleep(200); } const MessageManagerLock mml (Thread::getCurrentThread()); alertWindow->setVisible (false);}
开发者ID:jabelardo,项目名称:GIRL,代码行数:30,
示例16: nm_client_get_device_by_ifacevoid NMListener::run() { NMDevice *dev = nm_client_get_device_by_iface(nm, "wlan0"); context = g_main_context_default(); //context = g_main_context_new(); loop = g_main_loop_new(context, false); //g_main_context_invoke(context, initialize_in_context, status); g_signal_connect_swapped(nm, "notify::" NM_CLIENT_WIRELESS_ENABLED, G_CALLBACK(handle_wireless_enabled), wifiStatus); g_signal_connect_swapped(dev, "notify::" NM_DEVICE_STATE, G_CALLBACK(handle_wireless_connected), wifiStatus); g_signal_connect_swapped(NM_DEVICE_WIFI(dev), "notify::" NM_DEVICE_WIFI_ACTIVE_ACCESS_POINT, G_CALLBACK(handle_active_access_point), wifiStatus); g_signal_connect_swapped(NM_DEVICE_WIFI(dev), "access-point-added", G_CALLBACK(handle_changed_access_points), wifiStatus); g_signal_connect_swapped(NM_DEVICE_WIFI(dev), "access-point-removed", G_CALLBACK(handle_changed_access_points), wifiStatus); while (!threadShouldExit()) { { const MessageManagerLock mmLock; bool dispatched = g_main_context_iteration(context, false); } wait(LIBNM_ITERATION_PERIOD); } g_main_loop_unref(loop); g_main_context_unref(context);}
开发者ID:Celti,项目名称:PocketCHIP-pocket-home,代码行数:33,
示例17: run void run() override { wait (15000); if (! threadShouldExit()) Process::terminate(); }
开发者ID:0x4d52,项目名称:JUCE,代码行数:7,
示例18: run void run() { Array<int> randomValues; int lastRandomValue = 0; for (int i=1; i<=400; i++) { if ((Desktop::getMousePosition().x * Desktop::getMousePosition().y) != lastRandomValue) { randomValues.add (Desktop::getMousePosition().x * Desktop::getMousePosition().y); } lastRandomValue = Desktop::getMousePosition().x * Desktop::getMousePosition().y; setStatusMessage ("Random seed (move the mouse around to generate more): "+ STR(randomValues.size())); sleep (20); setProgress ((i / (double) 400)); if (threadShouldExit()) return; } setProgress (-1); setStatusMessage ("Generating 512 bit RSA key pair, this might take a moment"); sleep (5); RSAKey::createKeyPair (publicKey, privateKey, 512, randomValues.getRawDataPointer(), randomValues.size()); }
开发者ID:noscript,项目名称:ctrlr,代码行数:27,
示例19: run void run() override { setProgress (-1.0); // setting a value beyond the range 0 -> 1 will show a spinning bar.. setStatusMessage ("Preparing to do some stuff..."); wait (2000); const int thingsToDo = 10; for (int i = 0; i < thingsToDo; ++i) { // must check this as often as possible, because this is // how we know if the user's pressed 'cancel' if (threadShouldExit()) return; // this will update the progress bar on the dialog box setProgress (i / (double) thingsToDo); setStatusMessage (String (thingsToDo - i) + " things left to do..."); wait (500); } setProgress (-1.0); // setting a value beyond the range 0 -> 1 will show a spinning bar.. setStatusMessage ("Finishing off the last few bits and pieces!"); wait (2000); }
开发者ID:mmgeddie,项目名称:seniordesign,代码行数:27,
示例20: run void run() { #if JUCE_LINUX { MessageManagerLock mml (this); if (! mml.lockWasGained()) return; owner.updateContext(); owner.updateContextPosition(); } #endif while (! threadShouldExit()) { const uint32 startOfRendering = Time::getMillisecondCounter(); if (! owner.performRender()) break; const int elapsed = (int) (Time::getMillisecondCounter() - startOfRendering); Thread::sleep (jmax (1, (1000 / 60) - elapsed)); } #if JUCE_LINUX owner.deleteContext(); #endif }
开发者ID:adscum,项目名称:MoogLadders,代码行数:29,
示例21: posvoid SchemeThread::read(){ bool more=true; bool prompt=true; String text=String::empty; CodeDocument doc; CodeDocument::Position pos(&doc,0); while (more && !threadShouldExit()) { if (prompt) { Console::getInstance()->printPrompt(); prompt=false; } std::string line=""; getline(std::cin, line); if (!text.isEmpty()) text << T("/n"); text << String(line.c_str()); int typ; doc.replaceAllContent(text); pos.setPosition(0); typ=LispSyntax::getInstance()->scanCode(doc, pos, true, ScanIDs::MoveExpressions); if (typ==ScanIDs::SCAN_LIST || typ==ScanIDs::SCAN_TOKEN || typ==ScanIDs::SCAN_STRING) break; else if (typ==ScanIDs::SCAN_UNLEVEL) break; // allow too many parens to be passed to lisp? } if (!text.isEmpty()) eval(text);}
开发者ID:josephzizys,项目名称:CM,代码行数:31,
示例22: run void run() { while (! threadShouldExit()) { if (! pool.runNextJob()) wait (500); } }
开发者ID:AGenews,项目名称:GUI,代码行数:8,
示例23: whilevoid TimeSliceThread::run(){ int index = 0; while (! threadShouldExit()) { int timeToWait = 500; { Time nextClientTime; { const ScopedLock sl2 (listLock); index = clients.size() > 0 ? ((index + 1) % clients.size()) : 0; TimeSliceClient* const firstClient = getNextClient (index); if (firstClient != nullptr) nextClientTime = firstClient->nextCallTime; } const Time now (Time::getCurrentTime()); if (nextClientTime > now) { timeToWait = (int) jmin ((int64) 500, (nextClientTime - now).inMilliseconds()); } else { timeToWait = index == 0 ? 1 : 0; const ScopedLock sl (callbackLock); { const ScopedLock sl2 (listLock); clientBeingCalled = getNextClient (index); } if (clientBeingCalled != nullptr) { const int msUntilNextCall = clientBeingCalled->useTimeSlice(); const ScopedLock sl2 (listLock); if (msUntilNextCall >= 0) clientBeingCalled->nextCallTime += RelativeTime::milliseconds (msUntilNextCall); else clients.removeValue (clientBeingCalled); clientBeingCalled = nullptr; } } } if (timeToWait > 0) wait (timeToWait); }}
开发者ID:sonic59,项目名称:JuceEditor,代码行数:58,
示例24: whilevoid SocketListener::run() { char buffer[1024]; while (! threadShouldExit()) { if (socket->waitUntilReady(true, -1) != 1) break; if (threadShouldExit()) break; int len = socket->read (buffer, 1024, false); if (len < 1) break; listener->ProcessPacket(buffer, len); }}
开发者ID:richard-vogl,项目名称:JucyPaintAlinoBrick,代码行数:18,
示例25: run void run () { do { m_logic.periodicActivity(); wait (1000); } while (! threadShouldExit ()); }
开发者ID:Elviso40,项目名称:rippled,代码行数:9,
示例26: run void run() override { setProgress (-1.0); MemoryBlock zipData; result = download (zipData); if (result.wasOk() && ! threadShouldExit()) result = unzip (zipData); }
开发者ID:jkent,项目名称:JUCE,代码行数:10,
示例27: run void run() override { setThreadToAudioPriority(); if (recorder != nullptr) recorder->start(); if (player != nullptr) player->start(); while (! threadShouldExit()) processBuffers(); }
开发者ID:410pfeliciano,项目名称:JUCE,代码行数:10,
示例28: run void run() { initialiseJuce_GUI(); initialised = true; MessageManager::getInstance()->setCurrentThreadAsMessageThread(); while ((! threadShouldExit()) && MessageManager::getInstance()->runDispatchLoopUntil (250)) {} }
开发者ID:randi2kewl,项目名称:ShoutOut,代码行数:10,
注:本文中的threadShouldExit函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ thread_add_event函数代码示例 C++ threadMapMutex函数代码示例 |