示例#1
0
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;
}
示例#2
0
void *install_thread_f(gpointer data)
{
    Installer* inst = (Installer*) data;
    std::vector<Job*>& jobs = Installer::instance->GetJobs();
    try
    {
        for (size_t i = 0; i < jobs.size(); i++)
        {
            Job *j = jobs.at(i);
            inst->SetCurrentJob(j);
            j->Unzip();

            // Wait for an unzip job to finish before actually cancelling
            if (inst->GetStage() == Installer::CANCEL_REQUEST)
            {
                inst->SetStage(Installer::CANCELLED);
                return NULL;
            }
        }
    }
    catch (std::exception& e)
    {
        std::string message = e.what();
        inst->SetError(message);
        return NULL;
    }
    catch (std::string& e)
    {
        inst->SetError(e);
        return NULL;
    }
    catch (...)
    {
        std::string message = "Unknown error";
        inst->SetError(message);
        return NULL;
    }

    inst->SetStage(Installer::SUCCESS);
    return NULL;
}