void caseBranch (CaseItemPtr& caseItemHead, CaseItemPtr& caseItemTail, long& caseLabelCount, TypePtr expressionType) { //static CaseItemPtr oldCaseItemTail = NULL; CaseItemPtr oldCaseItemTail = caseItemTail; bool anotherLabel; do { TypePtr labelType = caseLabel(caseItemHead, caseItemTail, caseLabelCount); if (expressionType != labelType) syntaxError(ABL_ERR_SYNTAX_INCOMPATIBLE_TYPES); getToken(); if (curToken == TKN_COMMA) { getToken(); if (tokenIn(CaseLabelStartList)) anotherLabel = true; else { syntaxError(ABL_ERR_SYNTAX_MISSING_CONSTANT); anotherLabel = false; } } else anotherLabel = false; } while (anotherLabel); //-------------- // Error sync... synchronize(FollowCaseLabelList, statementStartList, NULL); ifTokenGetElseError(TKN_COLON, ABL_ERR_SYNTAX_MISSING_COLON); //----------------------------------------------------------------- // Fill in the branch location for each CaseItem for this branch... CaseItemPtr caseItem = (!oldCaseItemTail ? caseItemHead : oldCaseItemTail->next); //oldCaseItemTail = CaseItemTail; while (caseItem) { caseItem->branchLocation = codeBufferPtr; caseItem = caseItem->next; } if (curToken != TKN_END_CASE) do { statement(); while (curToken == TKN_SEMICOLON) getToken(); if (curToken == TKN_END_CASE) break; } while (tokenIn(statementStartList)); ifTokenGetElseError(TKN_END_CASE, ABL_ERR_SYNTAX_MISSING_END_CASE); ifTokenGetElseError(TKN_SEMICOLON, ABL_ERR_SYNTAX_MISSING_SEMICOLON); }
T& get (const std::string& filename, int type) { Synchronizable::lock_holder hnd(synchronize()); if (assets.count(type) == 0) { gdx_cpp::Gdx::app->error("AssetManager.hpp", "Asset '%s' not loaded", filename.c_str()); } const AssetMap& assetsByType = assets[type]; assert(assetsByType.count(filename)); // assetsByType[filename]; // T& asset = (T&) *(); // return asset; }
/* * This function is called only when the reporter thread * This function is the loop that the reporter thread processes */ void reporter_spawn( thread_Settings *thread ) { do { // This section allows for safe exiting with Ctrl-C Condition_Lock ( ReportCond ); if ( ReportRoot == NULL ) { // Allow main thread to exit if Ctrl-C is received thread_setignore(); Condition_Wait ( &ReportCond ); // Stop main thread from exiting until done with all reports thread_unsetignore(); } Condition_Unlock ( ReportCond ); again: if ( ReportRoot != NULL ) { ReportHeader *temp = ReportRoot; //Condition_Unlock ( ReportCond ); if(temp->report.mThreadMode == kMode_Client){ synchronize(); } if ( reporter_process_report ( temp ) ) { // This section allows for more reports to be added while // the reporter is processing reports without needing to // stop the reporter or immediately notify it Condition_Lock ( ReportCond ); if ( temp == ReportRoot ) { // no new reports ReportRoot = temp->next; } else { // new reports added ReportHeader *itr = ReportRoot; while ( itr->next != temp ) { itr = itr->next; } itr->next = temp->next; } // finished with report so free it free( temp ); Condition_Unlock ( ReportCond ); Condition_Signal( &ReportDoneCond ); if (ReportRoot) goto again; } Condition_Signal( &ReportDoneCond ); usleep(10000); } else { //Condition_Unlock ( ReportCond ); } } while ( 1 ); }
ClipboardMonitor::ClipboardMonitor(int &argc, char **argv) : Client() , App(createPlatformNativeInterface()->createMonitorApplication(argc, argv)) , m_formats() , m_newdata() , m_updateTimer( new QTimer(this) ) , m_needCheckClipboard(false) #ifdef COPYQ_WS_X11 , m_needCheckSelection(false) , m_x11(new PrivateX11) #endif #ifdef Q_OS_MAC , m_prevChangeCount(0) , m_clipboardCheckTimer(new MacTimer(this)) , m_macPlatform(new MacPlatform()) #endif { Q_ASSERT(argc == 3); const QString serverName( QString::fromUtf8(argv[2]) ); #ifdef HAS_TESTS if ( serverName == QString("copyq_TEST") ) QCoreApplication::instance()->setProperty("CopyQ_testing", true); #endif m_updateTimer->setSingleShot(true); m_updateTimer->setInterval(300); connect( m_updateTimer, SIGNAL(timeout()), this, SLOT(updateTimeout())); #ifdef COPYQ_WS_X11 connect( &m_x11->incompleteSelectionTimer(), SIGNAL(timeout()), this, SLOT(updateSelection()) ); connect( &m_x11->syncTimer(), SIGNAL(timeout()), this, SLOT(synchronize()) ); connect( &m_x11->resetClipboardTimer(), SIGNAL(timeout()), this, SLOT(resetClipboard()) ); #endif #ifdef Q_OS_MAC m_clipboardCheckTimer->setInterval(250); m_clipboardCheckTimer->setTolerance(500); connect(m_clipboardCheckTimer, SIGNAL(timeout()), this, SLOT(clipboardTimeout())); m_clipboardCheckTimer->start(); #endif Arguments arguments(argc, argv); if ( !startClientSocket(serverName, arguments) ) exit(1); }
main(int argc,char **argv) { unsigned start,end,i; printf(".4k8 -> .tap 1.0\n"); if (argc!=3) { printf("Usage: %s file.4k8 file.tap\n",argv[0]); exit(1);} in=fopen(argv[1],"rb"); out=fopen(argv[2],"wb"); if (in==NULL || out==NULL) { printf("Unable to open file\n"); exit(1);} synchronize(); sync_ok=1; while (!feof(in)) putc(getbyte(),out); fclose(in); fclose(out); exit(0); }
void GeneOntology::call_RAY_SLAVE_MODE_ONTOLOGY_MAIN(){ if(!m_slaveStarted){ m_listedRelevantColors=false; m_loadedAnnotations=false; m_countOntologyTermsInGraph=false; m_synced=false; m_waitingForReply=false; m_slaveStarted=true; }else if(!m_listedRelevantColors){ fetchRelevantColors(); }else if(!m_loadedAnnotations){ loadAnnotations(); loadOntology(&m_identifiers,&m_descriptions); }else if(!m_countOntologyTermsInGraph){ countOntologyTermsInGraph(); }else if(!m_synced){ synchronize(); }else{ if(m_rank==MASTER_RANK){ // busy wait for other to complete their tasks. if(m_ranksSynchronized<m_size){ return; } cout<<"Rank "<<m_rank<<": synchronization is complete!"<<endl; cout<<"Rank "<<m_rank<<": ontology terms with biological signal: "<<m_ontologyTermFrequencies.size()<<endl; writeOntologyFiles(); writeTrees(); } m_switchMan->closeSlaveModeLocally(m_outbox,m_rank); } }
AudioSettings::AudioSettings() { frequencyLabel.setText("Frequency:"); frequency.append("32000hz"); frequency.append("44100hz"); frequency.append("48000hz"); frequency.append("96000hz"); latencyLabel.setText("Latency:"); latency.append("20ms"); latency.append("40ms"); latency.append("60ms"); latency.append("80ms"); latency.append("100ms"); resamplerLabel.setText("Resampler:"); resampler.append("Linear"); resampler.append("Hermite"); resampler.append("Sinc"); volume.name.setText("Volume:"); volume.slider.setLength(201); append(controlLayout, {~0, 0}, 5); controlLayout.append(frequencyLabel, {0, 0}, 5); controlLayout.append(frequency, {~0, 0}, 5); controlLayout.append(latencyLabel, {0, 0}, 5); controlLayout.append(latency, {~0, 0}, 5); controlLayout.append(resamplerLabel, {0, 0}, 5); controlLayout.append(resampler, {~0, 0}); append(volume, {~0, 0}); switch(config->audio.frequency) { default: case 32000: frequency.setSelection(0); break; case 44100: frequency.setSelection(1); break; case 48000: frequency.setSelection(2); break; case 96000: frequency.setSelection(3); break; } switch(config->audio.latency) { default: case 20: latency.setSelection(0); break; case 40: latency.setSelection(1); break; case 60: latency.setSelection(2); break; case 80: latency.setSelection(3); break; case 100: latency.setSelection(4); break; } resampler.setSelection(config->audio.resampler); volume.slider.setPosition(config->audio.volume); frequency.onChange = latency.onChange = resampler.onChange = volume.slider.onChange = {&AudioSettings::synchronize, this}; synchronize(); }
unsigned long long FunctionalUnitManager::turnOn(const unsigned long &unitNumber, const unsigned long long &now) { synchronize(unitNumber, now); if(functionalUnits[unitNumber].status==FUS_ON) return 0; else if(functionalUnits[unitNumber].status==FUS_OFF) { functionalUnits[unitNumber].transitionTime = now; functionalUnits[unitNumber].nextClock=now+functionalUnits[unitNumber].onLatency; functionalUnits[unitNumber].lastPeakPower = 0; //do nothing with regards to power accum or timing } else if(functionalUnits[unitNumber].status==FUS_OFF_TRANSITION) { unsigned long long prevOnTime, chargedLatency; double powerTotal, currentPower, powerNotConsumed, transitionPoint; //Take total transition triangle power (or time since last transition) prevOnTime = functionalUnits[unitNumber].nextClock - functionalUnits[unitNumber].transitionTime; powerTotal = .5 * functionalUnits[unitNumber].lastPeakPower * (double)prevOnTime; //1/2 base * height (fixed.. if there are two mid transitions in a row or something //subtract smaller triangle //Using parametrized line, figure out what instantateous power is chargedLatency = now - functionalUnits[unitNumber].transitionTime; currentPower = functionalUnits[unitNumber].onPower - (functionalUnits[unitNumber].onPower/((double)prevOnTime))*(double)((functionalUnits[unitNumber].offLatency - prevOnTime) + chargedLatency); //instantaneous Power //Only add power that has been consumed powerNotConsumed = .5 * currentPower * (double)(prevOnTime - chargedLatency); //Subtract larger triangle from smaller one functionalUnits[unitNumber].totalPower += (powerTotal - powerNotConsumed); assert((powerTotal - powerNotConsumed) >= 0); //calculate transition point, and new latency transitionPoint = currentPower*((double)functionalUnits[unitNumber].onLatency/functionalUnits[unitNumber].onPower); // FIXME: Currently suffers all the latency for turning off, though // FIXED!!! // it is not fully turned on. functionalUnits[unitNumber].nextClock=now+(functionalUnits[unitNumber].onLatency - (unsigned long long)transitionPoint); functionalUnits[unitNumber].transitionTime = now; functionalUnits[unitNumber].lastPeakPower = currentPower; assert(functionalUnits[unitNumber].nextClock > now); } functionalUnits[unitNumber].status=FUS_ON_TRANSITION; return functionalUnits[unitNumber].nextClock; }
void Chatpad::init(HardwareSerial &serial, Chatpad::callback_t callback) { _serial = &serial; _callback = callback; _last_modifiers = 0; _last_key0 = 0; _last_key1 = 0; _last_ping = 0; _serial->begin(19200); _serial->write(kInitMessage, sizeof(kInitMessage)); /* 28/06/2015 fdufnews * call synchronize to find header in data stream */ synchronize(); }
void oCourse::setStart(const string &start, bool sync) { if (getDI().setString("StartName", start)) { if (sync) synchronize(); oClassList::iterator it; for (it=oe->Classes.begin();it!=oe->Classes.end();++it) { if (it->getCourse()==this) { it->setStart(start); if (sync) it->synchronize(); } } } }
// Initialize this d classifier code document void DClassifierCodeDocument::init() { setFileExtension(QLatin1String(".d")); //initCodeClassFields(); // this is dubious because it calls down to // CodeGenFactory::newCodeClassField(this) // but "this" is still in construction at that time. classDeclCodeBlock = 0; operationsBlock = 0; constructorBlock = 0; // this will call updateContent() as well as other things that sync our document. synchronize(); }
bool QGalleryTrackerResultSetPrivate::parseRows( const QDBusPendingCall &call, int limit, bool reset) { QDBusReply<QVector<QStringList> > reply(call); typedef QVector<QStringList>::const_iterator iterator; const QVector<QStringList> resultSet = reply.value(); QVector<QVariant> &values = iCache.values; if (reset) { values.clear(); iCache.count = 0; } iCache.count += resultSet.count(); values.reserve(iCache.count * tableWidth); for (iterator it = resultSet.begin(), end = resultSet.end(); it != end; ++it) { for (int i = 0, count = qMin(valueOffset, it->count()); i < count; ++i) values.append(it->at(i)); for (int i = valueOffset, count = qMin(tableWidth, it->count()); i < count; ++i) values.append(valueColumns.at(i - valueOffset)->toVariant(it->at(i))); // The rows should all have a count equal to tableWidth, but check just in case. for (int i = qMin(tableWidth, it->count()); i < tableWidth; ++i) values.append(QVariant()); } if (resultSet.count() <= limit) { if (!values.isEmpty() && !sortCriteria.isEmpty()) { correctRows( row_iterator(values.begin(), tableWidth), row_iterator(values.end(), tableWidth), sortCriteria.constBegin(), sortCriteria.constEnd()); } synchronize(); return true; } else { return false; } }
void DelayQueue::addEntry(DelayQueueEntry* newEntry) { synchronize(); DelayQueueEntry* cur = head(); while (newEntry->fDeltaTimeRemaining >= cur->fDeltaTimeRemaining) { newEntry->fDeltaTimeRemaining -= cur->fDeltaTimeRemaining; cur = cur->fNext; } cur->fDeltaTimeRemaining -= newEntry->fDeltaTimeRemaining; // Add "newEntry" to the queue, just before "cur": newEntry->fNext = cur; newEntry->fPrev = cur->fPrev; cur->fPrev = newEntry->fPrev->fNext = newEntry; }
unsigned long long FunctionalUnitManager::turnOff(const unsigned long &unitNumber, const unsigned long long &now) { synchronize(unitNumber, now); if(functionalUnits[unitNumber].status==FUS_OFF) return 0; else if(functionalUnits[unitNumber].status==FUS_ON) { functionalUnits[unitNumber].transitionTime = now; functionalUnits[unitNumber].nextClock=now+functionalUnits[unitNumber].offLatency; functionalUnits[unitNumber].lastPeakPower = functionalUnits[unitNumber].onPower; functionalUnits[unitNumber].totalPower += functionalUnits[unitNumber].onPower * (now - functionalUnits[unitNumber].onTime); assert((now - functionalUnits[unitNumber].onTime) >= 0); } else if(functionalUnits[unitNumber].status==FUS_ON_TRANSITION) { //if transition occured from another transition, figure out that point unsigned long long lastTransition = (unsigned long long)(((double)functionalUnits[unitNumber].onLatency/functionalUnits[unitNumber].onPower)*functionalUnits[unitNumber].lastPeakPower); //Using parametrized line, figure out what instantateous power is unsigned long long chargedLatency = now - functionalUnits[unitNumber].transitionTime; double currentPower = (functionalUnits[unitNumber].onPower/(double)functionalUnits[unitNumber].onLatency)*(double)(chargedLatency + lastTransition); //Only add power that has been consumed double powerConsumed = .5 * currentPower * (double)chargedLatency; double powerNotConsumed = .5 * functionalUnits[unitNumber].lastPeakPower * lastTransition; functionalUnits[unitNumber].totalPower += (powerConsumed - powerNotConsumed); assert((powerConsumed - powerNotConsumed) >= 0); // FIXME: Currently suffers all the latency for turning off, though // FIXED!!! // it is not fully turned on. //Find the intersection of the off transition curve and on transition curve (line because we're not doing exponentials) double transitionPoint = (functionalUnits[unitNumber].onPower - currentPower)*((double)functionalUnits[unitNumber].offLatency/functionalUnits[unitNumber].onPower); functionalUnits[unitNumber].nextClock=now+(functionalUnits[unitNumber].offLatency - (unsigned long long)transitionPoint); functionalUnits[unitNumber].transitionTime = now; functionalUnits[unitNumber].lastPeakPower = currentPower; assert(functionalUnits[unitNumber].nextClock > now); } functionalUnits[unitNumber].status=FUS_OFF_TRANSITION; return functionalUnits[unitNumber].nextClock; }
ClipboardMonitor::ClipboardMonitor(int &argc, char **argv) : QObject() , App(new QApplication(argc, argv)) , m_formats() , m_newdata() #ifdef COPYQ_WS_X11 , m_copyclip(false) , m_checksel(false) , m_copysel(false) #endif , m_socket( new QLocalSocket(this) ) , m_updateTimer( new QTimer(this) ) , m_needCheckClipboard(false) #ifdef COPYQ_WS_X11 , m_needCheckSelection(false) , m_x11(new PrivateX11) #endif { connect( m_socket, SIGNAL(readyRead()), this, SLOT(readyRead()), Qt::DirectConnection ); connect( m_socket, SIGNAL(disconnected()), QApplication::instance(), SLOT(quit()) ); QStringList args = QCoreApplication::instance()->arguments(); Q_ASSERT(args.size() == 3); const QString &serverName = args[2]; COPYQ_LOG( QString("Connecting to server \"%1\".").arg(serverName) ); m_socket->connectToServer(serverName); if ( !m_socket->waitForConnected(2000) ) { log( tr("Cannot connect to server!"), LogError ); exit(1); } COPYQ_LOG("Connected to server."); m_updateTimer->setSingleShot(true); m_updateTimer->setInterval(300); connect( m_updateTimer, SIGNAL(timeout()), this, SLOT(updateTimeout())); #ifdef COPYQ_WS_X11 connect( &m_x11->timer(), SIGNAL(timeout()), this, SLOT(updateSelection()) ); connect( &m_x11->syncTimer(), SIGNAL(timeout()), this, SLOT(synchronize()) ); #endif }
enum muchannel_reader_result muen_channel_read( const struct muchannel * const channel, struct muchannel_reader *reader, void *element) { uint64_t epoch, pos, wc, wsc; enum muchannel_reader_result result; if (muen_channel_is_active(channel)) { if (reader->epoch == MUCHANNEL_NULL_EPOCH || has_epoch_changed(channel, reader)) return synchronize(channel, reader); serialized_copy(&channel->hdr.wc, &wc); if (reader->rc == wc) result = MUCHANNEL_NO_DATA; else if (wc - reader->rc > reader->elements) { result = MUCHANNEL_OVERRUN_DETECTED; } else { pos = reader->rc % reader->elements * reader->size; memcpy(element, channel->data + pos, reader->size); cc_barrier(); serialized_copy(&channel->hdr.wsc, &wsc); if (wsc - reader->rc > reader->elements) { result = MUCHANNEL_OVERRUN_DETECTED; } else { result = MUCHANNEL_SUCCESS; reader->rc++; } if (has_epoch_changed(channel, reader)) { result = MUCHANNEL_EPOCH_CHANGED; epoch = 0; serialized_copy(&epoch, &reader->epoch); } } } else { reader->epoch = MUCHANNEL_NULL_EPOCH; result = MUCHANNEL_INACTIVE; } return result; }
void VisusDataProbe::display3D(VisusTransformation3D model_view_3D) { synchronize(); if (mDataLock.readLock() == 0) { vwarning("Could not lock data probe content for reading."); return; } glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadMatrixf(model_view_3D); // If we have a valid data source if (mDataSource->isValid()) { VisusBoundingBox bbox; mDataSource->domainBoundingBox(bbox); glColor3f(1,1,1); glDisable(GL_LIGHTING); glBegin(GL_LINES); glVertex3f(mPosition[0],mPosition[1],bbox[2]); glVertex3f(mPosition[0],mPosition[1],bbox[5]); glVertex3f(bbox[0],mPosition[1],mPosition[2]); glVertex3f(bbox[3],mPosition[1],mPosition[2]); glVertex3f(mPosition[0],bbox[1],mPosition[2]); glVertex3f(mPosition[0],bbox[4],mPosition[2]); glEnd(); } if (mDataLock.unlock() == 0) vwarning("Could not unlock data probe content."); for (CIterator it=mChildren.begin();it!=mChildren.end();it++) (*it)->display(model_view_3D); glPopMatrix(); }
void VisusDataProbe::translate(float x, float y) { VisusBoundingBox bbox; VisusTransformation3D acc; VisusTransformation3D matrix; VisusOpenGLState state; std::vector<float> trans; if (mDataLock.readLock() == 0) { vwarning("Could not lock data source for reading. Ignoring translation."); return; } if (mDataSource->isValid()) { mDataSource->domainBoundingBox(bbox); if (mDataLock.unlock() == 0) vwarning("Could not unlock data source."); accumulate3D(acc); getValue(matrix); getValue(state); trans = matrix.translation(acc,state,x,-y); trans[0] *= (bbox[3] - bbox[0]); trans[1] *= (bbox[4] - bbox[1]); trans[2] *= (bbox[5] - bbox[2]); matrix[12] += trans[0]; matrix[13] += trans[1]; matrix[14] += trans[2]; matrix[12] = MIN(bbox[3],MAX(bbox[0],matrix[12])); matrix[13] = MIN(bbox[4],MAX(bbox[1],matrix[13])); matrix[14] = MIN(bbox[5],MAX(bbox[2],matrix[14])); setValue(matrix); synchronize(true); } else { if (mDataLock.unlock() == 0) vwarning("Could not unlock data source."); } }
Common::Error XeenEngine::saveGameState(int slot, const Common::String &desc) { Common::OutSaveFile *out = g_system->getSavefileManager()->openForSaving( generateSaveName(slot)); if (!out) return Common::kCreatingFileFailed; XeenSavegameHeader header; header._saveName = desc; writeSavegameHeader(out, header); Common::Serializer s(nullptr, out); synchronize(s); out->finalize(); delete out; return Common::kNoError; }
void FunctionalUnitManager::synchronize(const unsigned long long &now) { if(now==globalClock) return; for( unsigned int i=0 ; i<functionalUnits.size() ; i++ ) { /* if(functionalUnits[i].status==FUS_ON_TRANSITION && functionalUnits[i].nextClock<=now) functionalUnits[i].status=FUS_ON; if(functionalUnits[i].status==FUS_OFF_TRANSITION && functionalUnits[i].nextClock<=now) functionalUnits[i].status=FUS_ON; */ synchronize(i, now); } globalClock=now; }
/*--------------------------------------------------------*/ void AzOptOnTree::optimize(AzRgfTreeEnsemble *rgf_ens, const AzTrTreeFeat *inp_tree_feat, bool doRefreshP, int ite_num, double lam, double sig) { ens = rgf_ens; tree_feat = inp_tree_feat; synchronize(); if (doRefreshP) { refreshPred(); } iterate(ite_num, lam, sig); updateTreeWeights(rgf_ens); ens = NULL; tree_feat = NULL; }
void irq_controller_isr(uint32_t addr) { uint32_t irq; irq = get_register(INTC_BASE + INTC_SIR_IRQ); irq_isr isr = irq_vectors[irq]; if(!isr) { uart_print(0, "No ISR for received IRQ\n"); for(;;); return; } isr(addr); set_register_bit_value(INTC_BASE + INTC_CONTROL, 0, 1); synchronize(); }
void pListView::constructor() { lostFocus = false; hwnd = CreateWindowEx( WS_EX_CLIENTEDGE, WC_LISTVIEW, L"", WS_CHILD | WS_TABSTOP | LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOSORTHEADER | LVS_NOCOLUMNHEADER, 0, 0, 0, 0, parentWindow->p.hwnd, (HMENU)id, GetModuleHandle(0), 0 ); SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)&listView); setDefaultFont(); setHeaderText(listView.state.headerText); setHeaderVisible(listView.state.headerVisible); setCheckable(listView.state.checkable); for(auto &text : listView.state.text) append(text); for(unsigned n = 0; n < listView.state.checked.size(); n++) setChecked(n, listView.state.checked[n]); setImageList(); if(listView.state.selected) setSelection(listView.state.selection); autoSizeColumns(); synchronize(); }
void StateManagerWindow::reload() { list->clear(); list->setSortingEnabled(false); if(SNES::cartridge.loaded() && cartridge.saveStatesSupported()) { for(unsigned n = 0; n < StateCount; n++) { QTreeWidgetItem *item = new QTreeWidgetItem(list); item->setData(0, Qt::UserRole, QVariant(n)); char slot[16]; sprintf(slot, "%2u", n + 1); item->setText(0, slot); } update(); } list->setSortingEnabled(true); list->header()->setSortIndicatorShown(false); synchronize(); }
void QNanoQuickItemPainter::presynchronize(QQuickFramebufferObject *item) { QNanoQuickItem *realItem = static_cast<QNanoQuickItem*>(item); if (realItem) { m_antialiasing = realItem->antialiasing(); m_pixelAlign = realItem->pixelAlign(); m_pixelAlignText = realItem->pixelAlignText(); m_fillColor = realItem->fillColor(); m_devicePixelRatio = realItem->window()->devicePixelRatio(); m_painter->enableHighQualityRendering(realItem->highQualityRendering()); } #ifdef QNANO_DEBUG m_debugTimer.start(); #endif synchronize(realItem); }
void NMainMenuBar::setupToolsMenu() { toolsMenu = this->addMenu(tr("&Tools")); QFont f; f.setPointSize(8); synchronizeAction = new QAction(tr("Synchronize"), this); synchronizeAction->setToolTip(tr("Close the program")); connect(synchronizeAction, SIGNAL(triggered()), parent, SLOT(synchronize())); setupShortcut(synchronizeAction, QString("Tools_Synchronize")); synchronizeAction->setFont(f); toolsMenu->addAction(synchronizeAction); disconnectAction = new QAction(tr("Disconnect"), this); synchronizeAction->setToolTip(tr("Disconnect from Evernote")); connect(disconnectAction, SIGNAL(triggered()), parent, SLOT(disconnect())); setupShortcut(disconnectAction, QString("Tools_Synchronize")); disconnectAction->setFont(f); toolsMenu->addAction(disconnectAction); disconnectAction->setEnabled(false); }
void QgsOfflineEditingPlugin::initGui() { delete mActionConvertProject; // Create the action for tool mActionConvertProject = new QAction( QIcon( ":/offline_editing/offline_editing_copy.png" ), tr( "Convert to offline project" ), this ); mActionConvertProject->setObjectName( "mActionConvertProject" ); // Set the what's this text mActionConvertProject->setWhatsThis( tr( "Create offline copies of selected layers and save as offline project" ) ); // Connect the action to the run connect( mActionConvertProject, SIGNAL( triggered() ), this, SLOT( convertProject() ) ); // Add the icon to the toolbar mQGisIface->addDatabaseToolBarIcon( mActionConvertProject ); mQGisIface->addPluginToDatabaseMenu( tr( "&Offline Editing" ), mActionConvertProject ); mActionConvertProject->setEnabled( false ); mActionSynchronize = new QAction( QIcon( ":/offline_editing/offline_editing_sync.png" ), tr( "Synchronize" ), this ); mActionSynchronize->setObjectName( "mActionSynchronize" ); mActionSynchronize->setWhatsThis( tr( "Synchronize offline project with remote layers" ) ); connect( mActionSynchronize, SIGNAL( triggered() ), this, SLOT( synchronize() ) ); mQGisIface->addDatabaseToolBarIcon( mActionSynchronize ); mQGisIface->addPluginToDatabaseMenu( tr( "&Offline Editing" ), mActionSynchronize ); mActionSynchronize->setEnabled( false ); mOfflineEditing = new QgsOfflineEditing(); mProgressDialog = new QgsOfflineEditingProgressDialog( mQGisIface->mainWindow(), QgisGui::ModalDialogFlags ); connect( mOfflineEditing, SIGNAL( progressStarted() ), this, SLOT( showProgress() ) ); connect( mOfflineEditing, SIGNAL( layerProgressUpdated( int, int ) ), this, SLOT( setLayerProgress( int, int ) ) ); connect( mOfflineEditing, SIGNAL( progressModeSet( QgsOfflineEditing::ProgressMode, int ) ), this, SLOT( setProgressMode( QgsOfflineEditing::ProgressMode, int ) ) ); connect( mOfflineEditing, SIGNAL( progressUpdated( int ) ), this, SLOT( updateProgress( int ) ) ); connect( mOfflineEditing, SIGNAL( progressStopped() ), this, SLOT( hideProgress() ) ); connect( mOfflineEditing, SIGNAL( warning( QString, QString ) ), mQGisIface->messageBar(), SLOT( pushWarning( QString, QString ) ) ); connect( mQGisIface->mainWindow(), SIGNAL( projectRead() ), this, SLOT( updateActions() ) ); connect( mQGisIface->mainWindow(), SIGNAL( newProject() ), this, SLOT( updateActions() ) ); connect( QgsProject::instance(), SIGNAL( writeProject( QDomDocument & ) ), this, SLOT( updateActions() ) ); connect( QgsMapLayerRegistry::instance(), SIGNAL( layerWasAdded( QgsMapLayer* ) ), this, SLOT( updateActions() ) ); connect( QgsMapLayerRegistry::instance(), SIGNAL( layerWillBeRemoved( QString ) ), this, SLOT( updateActions() ) ); updateActions(); }
bool muen_channel_has_pending_data(const struct muchannel * const channel, struct muchannel_reader * reader) { enum muchannel_reader_result res; uint64_t wc; if (!muen_channel_is_active(channel)) { return false; } if (MUCHANNEL_NULL_EPOCH == reader->epoch || has_epoch_changed(channel, reader)) { res = synchronize(channel, reader); if (MUCHANNEL_INCOMPATIBLE_INTERFACE == res) { return false; } } serialized_copy(&channel->hdr.wc, &wc); return wc > reader->rc; }
void parallelFor(const std::function<void(parallel::ThreadGroup g)>& function) { typedef std::list<std::thread> ThreadList; size_t threadCount = std::thread::hardware_concurrency(); ThreadList threads; for(size_t i = 0; i < threadCount; ++i) { threads.emplace_back(std::thread(function, ThreadGroup(threadCount, i))); } // barrier threads for(auto& thread : threads) { thread.join(); } synchronize(); }
//----------------------------------------------------------------------- void PhysXBridge::_update(Real timeElapsed) { if (!mScene) return; // Simulate the PhysX scene every x seconds mTimeSinceLastSimulation += timeElapsed; while (mTimeSinceLastSimulation > SIMULATION_INTERVAL) { // Simulate with SIMULATION_INTERVAL mScene->simulate(SIMULATION_INTERVAL); // Fetch simulation results mScene->flushStream(); mScene->fetchResults(NX_RIGID_BODY_FINISHED, true); // Broadcast to registered PhysXExterns synchronize(SIMULATION_INTERVAL); mTimeSinceLastSimulation -= SIMULATION_INTERVAL; } }