int main(int argc, char**argv) { printf("#################################\n"); printf("# DE STIJL PROJECT #\n"); printf("#################################\n"); //signal(SIGTERM, catch_signal); //signal(SIGINT, catch_signal); /* Avoids memory swapping for this program */ mlockall(MCL_CURRENT | MCL_FUTURE); /* For printing, please use rt_print_auto_init() and rt_printf () in rtdk.h * (The Real-Time printing library). rt_printf() is the same as printf() * except that it does not leave the primary mode, meaning that it is a * cheaper, faster version of printf() that avoids the use of system calls * and locks, instead using a local ring buffer per real-time thread along * with a process-based non-RT thread that periodically forwards the * contents to the output stream. main() must call rt_print_auto_init(1) * before any calls to rt_printf(). If you forget this part, you won't see * anything printed. */ rt_print_auto_init(1); initStruct(); startTasks(); pause(); deleteTasks(); return 0; }
void ChatView::startTasks() { # if defined(DEBUG_PERFORMANCE) QTime t; if (!m_messagesQueue.isEmpty()) qDebug() << "ChatView::startTasks()" << SimpleID::encode(m_id); # endif if (!m_messagesQueue.isEmpty()) { DEBUG_TIME_START if (m_messagesQueue.size() > MAX_MESSAGES_AT_ONCE) { QVariantList query; # if QT_VERSION >= 0x040700 query.reserve(MAX_MESSAGES_AT_ONCE); # endif for (int i = 0; i < MAX_MESSAGES_AT_ONCE; ++i) query.append(m_messagesQueue.takeFirst()); emit messages(query); DEBUG_TIME_ELAPSED_MQ QTimer::singleShot(0, this, SLOT(startTasks())); } else { emit messages(m_messagesQueue); DEBUG_TIME_ELAPSED_MQ m_messagesQueue.clear(); } }
void processTasks() { cocos2d::CCLog("==HTTP Started"); std::unique_lock<std::mutex> lock(_cond_mutex); while(true) { startTasks(); int still_running = 0; curl_multi_perform(cm, &still_running); int msgs_left = 0; CURLMsg *msg=NULL; while ((msg = curl_multi_info_read(cm, &msgs_left))) { if (msg->msg == CURLMSG_DONE) { CURL* curl = msg->easy_handle; CURLcode return_code = msg->data.result; onEnd(curl, return_code); } else { fprintf(stderr, "error: after curl_multi_info_read(), CURLMsg=%d\n", msg->msg); } } int old_running = getRunning(); startTasks(); int new_running = getRunning(); if(!still_running && new_running == 0) { cocos2d::CCLog("==HTTP sleep"); _cond.wait(lock); cocos2d::CCLog("==HTTP wakeup"); if(stop) return; } if(still_running && old_running == new_running) { int numfds=0; curl_multi_wait(cm, NULL, 0, 1000, &numfds); } } }
void HistoryDB::add(MessagePacket packet) { Q_ASSERT(m_self); if (!m_self) return; history::AddMessage *task = new history::AddMessage(packet); m_self->m_tasks.append(task); if (m_self->m_tasks.size() == 1) QTimer::singleShot(0, m_self, SLOT(startTasks())); }
void HistoryDB::add(const QByteArray &channelId, const QStringList &messages) { Q_ASSERT(m_self); if (messages.isEmpty() || !m_self) return; history::AddLast *task = new history::AddLast(channelId, messages); m_self->m_tasks.append(task); if (m_self->m_tasks.size() == 1) QTimer::singleShot(0, m_self, SLOT(startTasks())); }
void ChatView::add(const Message &msg) { if (!msg.isValid()) return; QVariantMap data = msg.data(); data[LS("Hint")] = addHint(msg); m_messagesQueue.append(data); if (m_loaded && m_messagesQueue.size() == 1) QTimer::singleShot(0, this, SLOT(startTasks())); }
void ZealSettingsDialog::endTasks(qint8 tasks = 1) { startTasks(-tasks); if( tasksRunning <= 0){ // Remove completed items for(int i=ui->docsetsList->count()-1;i>=0;--i){ QListWidgetItem *tmp = ui->docsetsList->item(i); if(tmp->data(ZealDocsetDoneInstalling).toBool() ){ tmp->setCheckState( Qt::Unchecked ); tmp->setHidden( true ); } } } }
void DetectionTask::extractArgs() { #if ASSIGN_CPUS // assign the task processor affinity in multiprocessor systems int32_t nCpus = sysconf(_SC_NPROCESSORS_CONF); cpu_set_t affinity; CPU_ZERO(&affinity); int32_t n = 0; if (nCpus > 2) { // remove affinity for cpu 1 ++n; } if (nCpus > 3) { // remove affinity for cpu 2 ++n; } // assign affinity for (int32_t i = n; i < nCpus; ++i) CPU_SET(i, &affinity); pid_t tid = gettid(); int rval = sched_setaffinity(tid, sizeof(cpu_set_t), &affinity); Assert(rval >= 0); #endif // extract startup args DetectionArgs *detectionArgs = static_cast<DetectionArgs *> (args); Assert(detectionArgs); controlQ = detectionArgs->controlQ; Assert(controlQ); #ifdef notdef superClusterer = detectionArgs->superClusterer; Assert(superClusterer); #endif msgList = MsgList::getInstance(); Assert(msgList); state = State::getInstance(); Assert(state); // create and start the dependent tasks createTasks(); startTasks(); }
/*! * Завершение загрузки документа. */ void ChatView::loadFinished() { m_loaded = true; m_autoscroll->setChecked(ChatCore::settings()->value(SETTINGS_AUTO_SCROLL).toBool()); m_seconds->setChecked(ChatCore::settings()->value(SETTINGS_DISPLAY_SECONDS).toBool()); m_service->setChecked(ChatCore::settings()->value(SETTINGS_DISPLAY_SERVICE).toBool()); evaluateJavaScript("showSeconds", m_seconds->isChecked()); evaluateJavaScript("showService", m_service->isChecked()); setId(m_id); ChatViewHooks::loadFinished(this); while (!m_pendingJs.isEmpty()) page()->mainFrame()->evaluateJavaScript(m_pendingJs.dequeue()); QTimer::singleShot(0, this, SLOT(startTasks())); while (!m_pendingFeeds.isEmpty()) emit feed(m_pendingFeeds.dequeue()); QTimer::singleShot(0, this, SLOT(alignChat())); }
void restartTasks() { startTasks(); }
void initBaseTasks() { startTasks(); }
void X3fDecoder::decompressSigma( X3fImage &image ) { ByteStream input(mFile->getDataWrt(image.dataOffset), image.dataSize); mRaw->dim.x = image.width; mRaw->dim.y = image.height; mRaw->setCpp(3); mRaw->isCFA = false; mRaw->createData(); curr_image = ℑ int bits = 13; if (image.format == 35) { for (int i = 0; i < 3; i++) { planeDim[i].x = input.getShort(); planeDim[i].y = input.getShort(); } bits = 15; } if (image.format == 30 || image.format == 35) { for (int i = 0; i < 3; i++) pred[i] = input.getShort(); // Skip padding input.skipBytes(2); createSigmaTable(&input, bits); // Skip padding (2 x 0x00) if (image.format == 35) { input.skipBytes(2+4); plane_offset[0] = image.dataOffset + 68; } else { // Skip padding (2 x 0x00) input.skipBytes(2); plane_offset[0] = image.dataOffset + 48; } for (int i = 0; i < 3; i++) { plane_sizes[i] = input.getUInt(); // Planes are 16 byte aligned if (i != 2) { plane_offset[i+1] = plane_offset[i] + (((plane_sizes[i] + 15) / 16) * 16); if (plane_offset[i]>mFile->getSize()) ThrowRDE("SigmaDecompressor:Plane offset outside image"); } } mRaw->clearArea(iRectangle2D(0,0,image.width,image.height)); startTasks(3); //Interpolate based on blue value if (image.format == 35) { int w = planeDim[0].x; int h = planeDim[0].y; for (int i = 0; i < 2; i++) { for (int y = 0; y < h; y++) { ushort16* dst = (ushort16*)mRaw->getData(0, y * 2 )+ i; ushort16* dst_down = (ushort16*)mRaw->getData(0, y * 2 + 1) + i; ushort16* blue = (ushort16*)mRaw->getData(0, y * 2) + 2; ushort16* blue_down = (ushort16*)mRaw->getData(0, y * 2 + 1) + 2; for (int x = 0; x < w; x++) { // Interpolate 1 missing pixel int blue_mid = ((int)blue[0] + (int)blue[3] + (int)blue_down[0] + (int)blue_down[3] + 2)>>2; int avg = dst[0]; dst[0] = clampbits(((int)blue[0] - blue_mid) + avg, 16); dst[3] = clampbits(((int)blue[3] - blue_mid) + avg, 16); dst_down[0] = clampbits(((int)blue_down[0] - blue_mid) + avg, 16); dst_down[3] = clampbits(((int)blue_down[3] - blue_mid) + avg, 16); dst += 6; blue += 6; blue_down += 6; dst_down += 6; } } } } return; } // End if format 30
void CampSiteActiveAreaImplementation::init(CampStructureTemplate* campData) { campStructureData = campData; setRadius(campStructureData->getRadius()); startTasks(); }
void CampSiteActiveAreaImplementation::initializeTransientMembers() { startTasks(); }