void CShareManager::umountAllImpl() { while(!mounted_.empty()) { QSharedPointer<SShare> p = *mounted_.begin(); umount(p); } while(!prepared_.empty()) { QSharedPointer<SShare> p = *prepared_.begin(); destroyPath(p); } }
static void processPathElement(xmlTextReaderPtr const xmlReaderP, canvas * const canvasP) { style style; const char * pathData; path * pathP; bool endOfPath; assert(xmlTextReaderNodeType(xmlReaderP) == XML_READER_TYPE_ELEMENT); assert(streq(currentNodeName(xmlReaderP), "path")); getPathAttributes(xmlReaderP, &style, &pathData); createPath(pathData, style, &pathP); if (pathP) { drawPath(canvasP, pathP); destroyPath(pathP); } endOfPath = xmlTextReaderIsEmptyElement(xmlReaderP); while (!endOfPath) { int rc; rc = xmlTextReaderRead(xmlReaderP); switch (rc) { case 1: processSubPathNode(xmlReaderP, &endOfPath); break; case 0: pm_error("Input file ends in the middle of a <path>"); break; default: pm_error("xmlTextReaderRead() failed, rc=%d", rc); } } }
void CShareManager::run() { while(true) { { QMutexLocker l(&taskListmutex_); while( !umountAll_ && taskList_.isEmpty() ) cond_.wait(&taskListmutex_); } if(umountAll_) { umountAllImpl(); return; } started_ = false; while(!taskList_.empty()) { if(!started_) { emit working(); started_ = true; } QPair<ETask, QSharedPointer<SShare> > task; { QMutexLocker l(&taskListmutex_); task = taskList_.front(); taskList_.pop_front(); } switch(task.first) { case Mount: mount(task.second); break; case MountAutoShare: mountAutoShare(task.second); break; case Umount: umount(task.second); break; case MakePath: makePath(task.second); break; case DestroyPath: destroyPath(task.second); break; default: break; } } if(started_) { started_ = false; emit done(); } } }