static CALresult mwDestroyCALInfo(MWCALInfo* ci)
{
    CALresult err = CAL_RESULT_OK;
    CALresult erri;

    err |= mwUnloadKernel(ci);
    if (ci->calctx)
    {
        erri = calCtxDestroy(ci->calctx);
        if (erri != CAL_RESULT_OK)
            cal_warn("Failed to destroy CAL context", erri);
        ci->calctx = 0;
        err |= erri;
    }

    if (ci->dev)
    {
        erri = calDeviceClose(ci->dev);
        if (erri != CAL_RESULT_OK)
            cal_warn("Failed to close device", erri);
        ci->dev = 0;
        err |= erri;
    }

    if (err != CAL_RESULT_OK)
        cal_warn("Failed to cleanup CAL info", err);

    return err;
}
Ejemplo n.º 2
0
CalDevice::~CalDevice()
{
    /* All resources must be freed */
    if (mHasContext) {
        calCtxDestroy(mCtx);
    }
    assert( mResources.empty() );
    calDeviceClose(mDevice);
}