void CGtserviceModule::StartWork() { //this work is default work CloseTimer(); AddWork(new CCollectWork); StartTimer(); }
void CSubmountsDlg::OnDelete() { HOURGLASS hourglass; int nIndex = m_SubmtList.GetCurSel(); ASSERT(nIndex >= 0); CString strSubmt; CString strShareName; m_SubmtList.GetText(nIndex, strSubmt); ASSERT(!strSubmt.IsEmpty()); strShareName = strSubmt.SpanExcluding(_T("=")); if (ShowMessageBox(IDS_REALLY_DELETE_SUBMT, MB_YESNO | MB_ICONQUESTION, IDS_REALLY_DELETE_SUBMT, strShareName) != IDYES) return; m_SubmtList.DeleteString(nIndex); if (m_SubmtList.GetCount() == 0) { m_Delete.EnableWindow(FALSE); m_Change.EnableWindow(FALSE); } CSubmountInfo *pInfo = new CSubmountInfo(); pInfo->SetShareName(strShareName); pInfo->SetStatus(SIS_DELETED); AddWork(pInfo); }
void DelegateSimpleThreadPool::JoinAll() { DCHECK(!threads_.empty()) << "JoinAll() called with no outstanding threads."; // Tell all our threads to quit their worker loop. AddWork(NULL, num_threads_); // Join and destroy all the worker threads. for (int i = 0; i < num_threads_; ++i) { threads_[i]->Join(); delete threads_[i]; } threads_.clear(); DCHECK(delegates_.empty()); }
void CSubmountsDlg::OnChange() { CAddSubmtDlg dlg; HOURGLASS hourglass; dlg.SetAddMode(FALSE); int nIndex = m_SubmtList.GetCurSel(); ASSERT(nIndex >= 0); CString strSubmt; CString strShareName; m_SubmtList.GetText(nIndex, strSubmt); ASSERT(!strSubmt.IsEmpty()); strShareName = strSubmt.SpanExcluding(_T("=")); CSubmountInfo *pInfo = FindWork(strShareName); if (pInfo != 0) // Make a copy we can free below pInfo = new CSubmountInfo(*pInfo); else pInfo = ReadSubmtInfo(strShareName); if (!pInfo) { ShowMessageBox(IDS_GET_SUBMT_INFO_ERROR, MB_ICONEXCLAMATION, IDS_GET_SUBMT_INFO_ERROR, strShareName); return; } dlg.SetSubmtInfo(pInfo); delete pInfo; if (dlg.DoModal() != IDOK) return; pInfo = dlg.GetSubmtInfo(); m_SubmtList.DeleteString(nIndex); m_SubmtList.InsertString(nIndex, pInfo->GetShareName() + "=" + pInfo->GetPathName()); AddWork(pInfo); }
void CSubmountsDlg::OnAdd() { CAddSubmtDlg dlg; if (m_bAddOnlyMode) { CSubmountInfo info("", m_strAddOnlyPath, SIS_ADDED); dlg.SetSubmtInfo(&info); } dlg.DoModal(); CSubmountInfo *pInfo = dlg.GetSubmtInfo(); if (!pInfo) return; m_SubmtList.AddString(pInfo->GetShareName() + "=" + pInfo->GetPathName()); AddWork(pInfo); }
void CNrpPlant::Load( const NrpText& saveFolder ) { NrpText fileName = OpFileSystem::CheckEndSlash( saveFolder ) + "plant.ini"; assert( OpFileSystem::IsExist( fileName ) ); INrpConfig::Load( fileName ); IniFile rv( fileName ); int maxNumber = (int)Param( WORKNUMBER ) + (int)Param( REKLAMENUMBER ); for( int k=0; k < maxNumber; k++ ) { NrpText type = rv.Get( SECTION_WORKS, CreateKeyType( k ), NrpText("") ); NrpText saveFile = rv.Get( SECTION_WORKS, CreateKeyWork( k ), NrpText("") ); if( OpFileSystem::IsExist( saveFile ) ) { if( type == CNrpPlantWork::ClassName() ) AddWork( new CNrpPlantWork( saveFile, true ) ); else if( type == CNrpReklameWork::ClassName() ) AddReklame( CNrpReklameWork( saveFile ) ); } } }
/* * Compose stage file events into a stage stream. Streams * represent optimal i/o requests for media. A stream is * added to work queue. */ void Compose(void) { FileInfo_t **sortList; StreamInfo_t *stream; FileInfo_t *file; char *currentVsn; int i; int copy; int retry; boolean_t added; if (composeList.entries == 0) { return; } sortList = makeSortList(); separateVsns(sortList); currentVsn = NULL; stream = NULL; for (i = 0; i < composeList.entries; i++) { file = GetFile(composeList.data[i]); copy = file->copy; /* * If first VSN (currentVsn == NULL) or different VSN or * disk cache already open, ie. multivolume, create a new * stream. Add new stream to the work queue. */ if (currentVsn == NULL || (strcmp(file->ar[copy].section.vsn, currentVsn) != 0) || GET_FLAG(file->flags, FI_DCACHE)) { retry = 3; stream = NULL; while (stream == NULL && retry-- > 0) { stream = CreateStream(file); if (stream == NULL) { SetErrno = 0; /* set for trace */ Trace(TR_ERR, "Create stream failed"); sleep(5); } } if (stream == NULL) { FatalSyscallError(EXIT_FATAL, HERE, "Compose create stream", currentVsn); } AddWork(stream); if (GET_FLAG(file->flags, FI_DCACHE_CLOSE) == 0) { currentVsn = file->ar[copy].section.vsn; } } /* * Add stage request to the stream. */ added = AddStream(stream, composeList.data[i], ADD_STREAM_NOSORT); if (added == B_FALSE) { SetErrno = 0; /* set for trace */ Trace(TR_ERR, "Compose add stream '%s.%d' 0x%x failed", stream->vsn, stream->seqnum, (int)stream); SET_FLAG(stream->flags, SR_full); } /* Stream is full, create a new one. */ if (GET_FLAG(stream->flags, SR_full)) { currentVsn = NULL; } } /* * We should have added all requests to the work queue * so free the composition list. */ composeList.entries = 0; }