コード例 #1
0
ファイル: ThreadHandler.cpp プロジェクト: MaddTheSane/haiku
void
ThreadHandler::HandleThreadStateChanged()
{
	AutoLocker<Team> locker(fThread->GetTeam());

	// cancel jobs for this thread
	fWorker->AbortJob(SimpleJobKey(fThread, JOB_TYPE_GET_CPU_STATE));
	fWorker->AbortJob(SimpleJobKey(fThread, JOB_TYPE_GET_STACK_TRACE));

	// If the thread is stopped and has no CPU state yet, schedule a job.
	if (fThread->State() == THREAD_STATE_STOPPED
			&& fThread->GetCpuState() == NULL) {
		fWorker->ScheduleJob(
			new(std::nothrow) GetCpuStateJob(fDebuggerInterface, fThread));
	}
}
コード例 #2
0
void
ThreadHandler::HandleCpuStateChanged()
{
	AutoLocker<Team> locker(fThread->GetTeam());

	// cancel stack trace job for this thread
	fWorker->AbortJob(SimpleJobKey(fThread, JOB_TYPE_GET_STACK_TRACE));

	// If the thread has a CPU state, but no stack trace yet, schedule a job.
	if (fThread->GetCpuState() != NULL && fThread->GetStackTrace() == NULL) {
		fWorker->ScheduleJob(
			new(std::nothrow) GetStackTraceJob(fDebuggerInterface,
				fDebuggerInterface->GetArchitecture(), fThread));
	}
}
コード例 #3
0
ファイル: Jobs.cpp プロジェクト: nielx/haiku-serviceskit
status_t
GetStackTraceJob::GetImageDebugInfo(Image* image, ImageDebugInfo*& _info)
{
    AutoLocker<Team> teamLocker(fThread->GetTeam());

    while (image->GetImageDebugInfo() == NULL) {
        // schedule a job, if not loaded
        ImageDebugInfo* info;
        status_t error = LoadImageDebugInfoJob::ScheduleIfNecessary(GetWorker(),
                         image, &info);
        if (error != B_OK)
            return error;

        if (info != NULL) {
            _info = info;
            return B_OK;
        }

        teamLocker.Unlock();

        // wait for the job to finish
        switch (WaitFor(SimpleJobKey(image, JOB_TYPE_LOAD_IMAGE_DEBUG_INFO))) {
        case JOB_DEPENDENCY_SUCCEEDED:
        case JOB_DEPENDENCY_NOT_FOUND:
            // "Not found" can happen due to a race condition between
            // unlocking the worker and starting to wait.
            break;
        case JOB_DEPENDENCY_FAILED:
        case JOB_DEPENDENCY_ABORTED:
        default:
            return B_ERROR;
        }

        teamLocker.Lock();
    }

    _info = image->GetImageDebugInfo();
    _info->AcquireReference();

    return B_OK;
}