当前位置: 首页>>代码示例>>C++>>正文


C++ Job类代码示例

本文整理汇总了C++中Job的典型用法代码示例。如果您正苦于以下问题:C++ Job类的具体用法?C++ Job怎么用?C++ Job使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Job类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: gtk_progress_bar_set_fraction

void Installer::UpdateProgress()
{
    Job *j = this->CurrentJob();

    if (this->window == NULL)
        return;

    Stage s = this->GetStage();
    if (j != NULL && (s == DOWNLOADING || s == INSTALLING))
    {
        double progress = j->GetProgress();
        gtk_progress_bar_set_fraction(
            GTK_PROGRESS_BAR(this->progressBar),
            progress);

        std::ostringstream text;
        if (s == INSTALLING)
            text << "Installing ";
        else
            text << "Downloading ";
        text << "package " << j->Index() << " of " << Job::total;

        gtk_label_set_text(GTK_LABEL(this->downloadingLabel), text.str().c_str());

    }
    else if (s == PREINSTALL)
    {
        gtk_progress_bar_set_fraction(
            GTK_PROGRESS_BAR(this->progressBar),
            1.0);
    }
    
}
开发者ID:fossamikom,项目名称:TideSDK,代码行数:33,代码来源:installer.cpp

示例2: setup

	void setup( const Record & record, const QModelIndex & idx )
	{
		RecordItem::setup(record,idx);
		Job j = JobAssignment(record).job();
		if( j.isRecord() )
			services = j.jobServices().services().services().join(",");
	}
开发者ID:carriercomm,项目名称:arsenalsuite,代码行数:7,代码来源:hosthistoryview.cpp

示例3: file_error

//Same as make_job_from_cin but everything is processed from an istream instead of user
//input. See above for more details and comments explaining code segments
bool Scheduler::make_job_from_line(istream &inFile) {
	int  pid;
	int  execTime;
	int  resources;
	
	inFile >> pid;
	inFile >> execTime;
	inFile >> resources;
	
	Job *j = jobs.find(pid);
	win.clear_console();
		if (execTime <= 0) {
		return file_error("Eecution time must be positive", pid, inFile);
	} else if (resources > MAX_MEMORY) {
		return file_error("Cannot use more than MAX MEMORY.", pid, inFile);
	} else if (resources < 0) {
		return file_error("Resources cannot be negative.", pid, inFile);	
	} else if (j != NULL && j->get_status() != Job::LATENT) {
		return file_error("job already exists", pid, inFile);
	} else if (j == NULL) {
		j = new Job(pid);
		jobs.insert(j);
	} 
	
	j->prepare(execTime, resources); //(see details above)
	read_dependencies(j, true, inFile);

	if (j->no_dependencies())
		waitingOnMem.push(j);
	
	j->set_clock_insert(runClock);
	win.feed_bar("Created new job PID #%d", pid);
	return true;
}
开发者ID:dillonbostwick,项目名称:SharkBatch,代码行数:36,代码来源:Scheduler.cpp

示例4: _GetUserID

void
LaunchDaemon::_HandleGetLaunchTargetInfo(BMessage* message)
{
	uid_t user = _GetUserID(message);
	if (user < 0)
		return;

	const char* name = message->GetString("name");
	Target* target = FindTarget(name);
	if (target == NULL && !fUserMode) {
		_ForwardEventMessage(user, message);
		return;
	}

	BMessage info(uint32(target != NULL ? B_OK : B_NAME_NOT_FOUND));
	if (target != NULL) {
		_GetBaseJobInfo(target, info);

		for (JobMap::iterator iterator = fJobs.begin(); iterator != fJobs.end();
				iterator++) {
			Job* job = iterator->second;
			if (job->Target() == target)
				info.AddString("job", job->Name());
		}
	}
	message->SendReply(&info);
}
开发者ID:garodimb,项目名称:haiku,代码行数:27,代码来源:LaunchDaemon.cpp

示例5: catch

void *install_thread_f(gpointer data)
{
	Installer* inst = (Installer*) data;
	std::vector<Job*>& jobs = inst->GetJobs();
	try
	{
		for (size_t i = 0; i < jobs.size(); i++)
		{
			Job *j = jobs.at(i);
			inst->SetCurrentJob(j);
			j->Unzip();
		}
	}
	catch (std::exception& e)
	{
		std::string message = e.what();
		inst->SetError(message);
	}
	catch (std::string& e)
	{
		inst->SetError(e);
	}
	catch (...)
	{
		std::string message = "Unknown error";
		inst->SetError(message);
	}

	inst->SetRunning(false);
	inst->SetCurrentJob(NULL);
	return NULL;
}
开发者ID:pjunior,项目名称:titanium,代码行数:32,代码来源:installer.cpp

示例6: intermediate

 void intermediate(Job &job, results &result)
 {
     auto const start_time(std::chrono::system_clock::now());
     for (unsigned partition=0; partition<job.number_of_partitions(); ++partition)
         job.run_intermediate_results_shuffle(partition);
     result.shuffle_runtime = std::chrono::system_clock::now() - start_time;
 }
开发者ID:304471720,项目名称:mapreduce,代码行数:7,代码来源:sequential.hpp

示例7: XInitThreads

void* JobPoolWorker::Entry()
{
#ifdef LINUX
    XInitThreads();
#endif
    while ( !stopped ) {
        // Did we get a request to terminate?
        if (TestDestroy())
            break;

        Job *job = GetJob();
        if (job) {
            // Call user's implementation for processing request
            ProcessJob(job);
            if (job->DeleteWhenComplete()) {
                delete job;
            }
            job = NULL;
        } else {
            std::unique_lock<std::mutex> mutLock(*lock);
            if (idleThreads > 5) {
                break;
            }
        }
    }
    std::unique_lock<std::mutex> mutLock(*lock);
    numThreads--;
    return NULL;
}
开发者ID:Jchuchla,项目名称:xLights,代码行数:29,代码来源:JobPool.cpp

示例8: generateRandom

void *submissionThread(int threadID) {
	int rate = generateRandom(MIN_CREATION_RATE, MAX_CREATION_RATE);
	printf("Submission thread %d creating jobs every %d seconds\n", threadID, rate);

	int t = currentTime();
	int i = 0;
	while (jobCounter != MAX_JOBS_PER_THREAD * NUMBER_OF_SUBMISSION_THREADS - 1) {
		if (currentTime() > t + rate && i < MAX_JOBS_PER_THREAD) {
			t = currentTime();
			Job job = createRandomJob();
			//job.printJob(&job);
			if (job.currentPhase(&job).type == CPU_PHASE) {
				cpuQueue.enqueue(&cpuQueue, job);
				printf("Job %d put on CPU Queue by Submission Thread %d\n", job.id, threadID);
			} else if (job.currentPhase(&job).type == IO_PHASE) {
				ioQueue.enqueue(&ioQueue, job);
				printf("Job %d put on IO Queue by Submission Thread %d\n", job.id, threadID);
			}
			i++;
		} else {
			if (finishedQueue.getSize(&finishedQueue) > 0) {
				Job job = finishedQueue.dequeue(&finishedQueue);
				printf("Job %d taken off of Finished Queue by Submission Thread %d\n", job.id, threadID);
				job.printJob(&job);
				jobCounter++;
				printf("Jobs processed: %d\n", jobCounter + 1);
				if (jobCounter == MAX_JOBS_PER_THREAD * NUMBER_OF_SUBMISSION_THREADS - 1) {
					break;
				}
			}
		}
	}
}
开发者ID:TimMikeladze,项目名称:css422-homework2,代码行数:33,代码来源:main.c

示例9: getJob

void ProgressTree2::cancelClicked()
{
    CancelPushButton* pb = static_cast<CancelPushButton*>(QObject::sender());
    pb->setEnabled(false);
    Job* job = getJob(*pb->item);
    job->cancel();
}
开发者ID:benpope82,项目名称:npackd-cpp,代码行数:7,代码来源:progresstree2.cpp

示例10: scheduleEarly

PSchedule Schedule :: scheduleEarly(ActiveList *activeList,
                                    const vector<Resource *> *resources)
{
    PSchedule schedule(new Schedule(activeList, resources));
    schedule->_type = ScheduleTypeEarly;
    
    for (int i=0; i<activeList->size(); i++) {
        Job *job = (*activeList)[i];
        schedule->_starts[job] = 0;
        
        for (auto &predecessor : *job->predecessors()) {
            schedule->_starts[job] = max(schedule->start(job), schedule->end(predecessor));
        }
        
        for (int time = 0; time < job->duration(); time++) {
            for (auto &pResourceAmount : *job->resourceAmounts()) {
                if (schedule->resourceRemain(pResourceAmount.first, schedule->start(job) + time) <
                    pResourceAmount.second) {
                    schedule->_starts[job] += time + 1;
                    time = -1;
                    break;
                }
            }
        }
        
        schedule->reduceResourceRemain(job);
    }
    
    return schedule;
}
开发者ID:leonovvalentin,项目名称:psp,代码行数:30,代码来源:Schedule.cpp

示例11: shooSH_run

/*!
 *	\brief Funcao que executa a Shell.
 */
void shooSH_run (void) {
	Job* job;
	Parser p;
	Executor executor;
	bool exited = false;
	
	while (!exited) {
		std::cout << "shooSH> ";
		job = p.parseLine ();
		history.push_back (job->getCommand());
		if (job->hasFailed ()) {
			std::cout << "Erro de sintaxe" << std::endl;
		} else {
			if (!(job->isNop()||job->hasExited())) {
				if (!job->hasPipe()) {
					if (executeBuiltin (job->getProcess(0)) == -1) {
						job->setID (++currID);
						jobList.push_back (job);
						executor.execute (job);
					}
				} else {
					job->setID (++currID);
					jobList.push_back (job);
					executor.execute (job);
				}
			} else {
				exited = job->hasExited();
			}
		}
		job = NULL;
	}
	shooSH_clean();
}
开发者ID:bimaoe,项目名称:shooSH---SOII-2011,代码行数:36,代码来源:shooSH.hpp

示例12: dprintf

bool
JobServerJobLogConsumer::DestroyClassAd(const char *_key)
{

	// ignore the marker
	if (strcmp(_key,"0.0") == 0) {
	  return true;
	}

   dprintf ( D_FULLDEBUG, "JobServerJobLogConsumer::DestroyClassAd - key '%s'\n", _key);
    JobCollectionType::iterator g_element = g_jobs.find(_key);

    if (g_jobs.end() == g_element) {
        dprintf(D_ALWAYS,
                "error reading job queue log: no such job found for key '%s'\n",
                _key);
        return false;
    }

    Job* job = (*g_element).second;
    // Destroy will figure out the submission decrement
    if (job->destroy()) {
            delete job;
            job = NULL;
            g_jobs.erase(g_element);
    }

    return true;
}
开发者ID:emaste,项目名称:htcondor,代码行数:29,代码来源:JobServerJobLogConsumer.cpp

示例13: QString

void ListView::dropEvent(QDropEvent *event)
{
  const QMimeData *mimeData = event->mimeData();

  QStringList imagePaths;
  QList<QUrl> imageUrls = mimeData->urls();
  QList<QUrl>::const_iterator end = imageUrls.constEnd();

  for (QList<QUrl>::const_iterator count = imageUrls.constBegin(); count != end; count++) {
    QString path = (*count).toLocalFile();
    if (!path.isEmpty() && path.contains(GCore::Data::self()->supportedFormats()))
      imagePaths << path;
  }

  QString image = imagePaths.first();
  image.remove(QRegExp("^.+/"));
  QString path = imagePaths.first();
  path.remove(image);

  QStringList pictures = imagePaths;
  pictures.replaceInStrings(path, QString());

  QAction *choice = Data::self()->dropContextMenu()->exec(mapToGlobal(event->pos()));

  if (!choice)
    return;

  if (choice->data().toInt() == 0) {
    NewGalleryWizard *wizard = new NewGalleryWizard(path, pictures, this);
    wizard->show();
  } else if (choice->data().toInt() == 1) {
    Job job = JobManager::self()->addImages(rootIndex(), imagePaths);
    connect(job.jobPtr(), SIGNAL(progress(int, int, const QString&, const QImage&)), GCore::Data::self()->imageAddProgress(), SLOT(setProgress(int, int, const QString&, const QImage&)));
  }
开发者ID:BackupTheBerlios,项目名称:galerist-svn,代码行数:34,代码来源:listview.cpp

示例14: fopen

void MIDI_Fighter::loadConfig(){
	FILE * fd = NULL;
	fd = fopen(CONFIG_FILE, "r"); 
	if (fd != NULL){
		//TODO: Load the file and do things
	}
	else{
		LOG(ERR, "MIDIFighter", "Error loading MIDIFighter config file. Reverting to hex codes");
		//HACK: test string loader
		Job* tmp = new Job();
		tmp->addAction(new Action_string("Hello World!\\VK_RETURN;"));
		//HACK: end test

		for (int j = 0; j < NUM_BANKS; j++){
			for (int i = 0; i < BTNS_PER_BANK; i++){
				if (i == 0){
					banks[j].btn[i] = tmp;
				}
				else{
					banks[j].btn[i] = new Job();
					banks[j].btn[i]->addAction(new Action_key(decToHex(i), true));
					banks[j].btn[i]->addAction(new Action_key(decToHex(i), false));
				}
			}
		}
		return;
	}
}
开发者ID:sqfink,项目名称:MIDI_remap,代码行数:28,代码来源:MIDI_Fighter.cpp

示例15: createRandomJob

Job createRandomJob() {
	int numberOfPhases = generateRandom(MIN_NUMBER_OF_PHASES, MAX_NUMBER_OF_PHASES);
	Phase phases[numberOfPhases];
	int i = 0;
	PhaseType type;

	for (i = 0; i < numberOfPhases; i++) {
		int duration = generateRandom(1, MAX_DURATION);
		Phase phase;
		phase.duration = duration;
		if (type == CPU_PHASE) {
			type = IO_PHASE;
		} else if (type == IO_PHASE) {
			type = CPU_PHASE;
		} else {
			type = duration % 2 == 0 ? CPU_PHASE : IO_PHASE;
		}
		phase.type = type;
		phases[i] = phase;
	}

	Job job = createJob(phases, numberOfPhases);
	printf("Created Job %d\n", job.id);
	job.printJob(&job);

	return job;
}
开发者ID:TimMikeladze,项目名称:css422-homework2,代码行数:27,代码来源:main.c


注:本文中的Job类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。