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


C++ JobQueue::AddJob方法代码示例

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


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

示例1: InitRealTimeClockJob

/*!	Basic system initialization that must happen before any jobs are launched.
*/
void
LaunchDaemon::_InitSystem()
{
	_AddInitJob(new InitRealTimeClockJob());
	_AddInitJob(new InitSharedMemoryDirectoryJob());
	_AddInitJob(new InitTemporaryDirectoryJob());

	fJobQueue.AddJob(fInitTarget);
}
开发者ID:garodimb,项目名称:haiku,代码行数:11,代码来源:LaunchDaemon.cpp

示例2: FindJob

/*!	Adds the specified \a job to the launch queue
	queue, except those that are triggered by events.

	Unless \c FORCE_NOW is set, the target is only launched if its events,
	if any, have been triggered already.

	Calling this method will trigger a demand event if \c TRIGGER_DEMAND has
	been set.
*/
bool
LaunchDaemon::_LaunchJob(Job* job, uint32 options)
{
	if (job != NULL && (job->IsLaunching() || job->IsRunning()))
		return true;

	if (!_CanLaunchJob(job, options))
		return false;

	// Test if we can launch all requirements
	if (!_CanLaunchJobRequirements(job, options | TRIGGER_DEMAND))
		return false;

	// Actually launch the requirements
	int32 count = job->Requirements().CountStrings();
	for (int32 index = 0; index < count; index++) {
		Job* requirement = FindJob(job->Requirements().StringAt(index));
		if (requirement != NULL) {
			// TODO: For jobs that have their communication channels set up,
			// we would not need to trigger demand at this point
			if (!_LaunchJob(requirement, options | TRIGGER_DEMAND)) {
				// Failed to put a requirement into the launch queue
				return false;
			}
		}
	}

	if (job->Target() != NULL)
		job->Target()->ResolveSourceFiles();
	if (job->Event() != NULL)
		job->Event()->ResetTrigger();

	job->SetLaunching(true);

	status_t status = fJobQueue.AddJob(job);
	if (status != B_OK) {
		debug_printf("Adding job %s to queue failed: %s\n", job->Name(),
			strerror(status));
		return false;
	}

	// Try to launch pending jobs as well
	count = job->Pending().CountStrings();
	for (int32 index = 0; index < count; index++) {
		Job* pending = FindJob(job->Pending().StringAt(index));
		if (pending != NULL && _LaunchJob(pending, 0)) {
			// Remove the job from the pending list once its in the launch
			// queue, so that is not being launched again next time.
			index--;
			count--;
		}
	}

	return true;
}
开发者ID:garodimb,项目名称:haiku,代码行数:64,代码来源:LaunchDaemon.cpp

示例3: FindJob

/*!	Adds the specified \a job to the launch queue
	queue, except those that are triggered by events.

	Unless \a forceNow is true, the target is only launched if its events,
	if any, have been triggered already.

	Calling this method will trigger a demand event.
*/
void
LaunchDaemon::_LaunchJob(Job* job, bool forceNow)
{
	if (job == NULL || job->IsLaunched() || (!forceNow
		&& (!job->EventHasTriggered() || !job->CheckCondition(*this)
			|| Events::TriggerDemand(job->Event())))) {
		return;
	}

	int32 count = job->Requirements().CountStrings();
	for (int32 index = 0; index < count; index++) {
		Job* requirement = FindJob(job->Requirements().StringAt(index));
		if (requirement != NULL)
			_LaunchJob(requirement);
	}

	if (job->Target() != NULL)
		job->Target()->ResolveSourceFiles();
	if (job->Event() != NULL)
		job->Event()->ResetTrigger();

	fJobQueue.AddJob(job);
}
开发者ID:puckipedia,项目名称:haiku,代码行数:31,代码来源:LaunchDaemon.cpp

示例4:

void
LaunchDaemon::_AddInitJob(BJob* job)
{
	fInitTarget->AddDependency(job);
	fJobQueue.AddJob(job);
}
开发者ID:garodimb,项目名称:haiku,代码行数:6,代码来源:LaunchDaemon.cpp


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