本文整理汇总了C++中QThread::isInterruptionRequested方法的典型用法代码示例。如果您正苦于以下问题:C++ QThread::isInterruptionRequested方法的具体用法?C++ QThread::isInterruptionRequested怎么用?C++ QThread::isInterruptionRequested使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QThread
的用法示例。
在下文中一共展示了QThread::isInterruptionRequested方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: syncAndRender
void QWinRTAbstractVideoRendererControl::syncAndRender()
{
qCDebug(lcMMVideoRender) << __FUNCTION__;
Q_D(QWinRTAbstractVideoRendererControl);
QThread *currentThread = QThread::currentThread();
const QMetaMethod present = staticMetaObject.method(staticMetaObject.indexOfMethod("present()"));
forever {
if (currentThread->isInterruptionRequested())
break;
{
CriticalSectionLocker lock(&d->mutex);
HRESULT hr;
if (d->dirtyState == TextureDirty) {
CD3D11_TEXTURE2D_DESC desc(DXGI_FORMAT_B8G8R8A8_UNORM, d->format.frameWidth(), d->format.frameHeight(), 1, 1);
desc.BindFlags |= D3D11_BIND_RENDER_TARGET;
desc.MiscFlags = D3D11_RESOURCE_MISC_SHARED;
hr = g->device->CreateTexture2D(&desc, NULL, d->texture.ReleaseAndGetAddressOf());
BREAK_IF_FAILED("Failed to get create video texture");
ComPtr<IDXGIResource> resource;
hr = d->texture.As(&resource);
BREAK_IF_FAILED("Failed to cast texture to resource");
hr = resource->GetSharedHandle(&d->shareHandle);
BREAK_IF_FAILED("Failed to get texture share handle");
d->dirtyState = SurfaceDirty;
}
hr = g->output->WaitForVBlank();
CONTINUE_IF_FAILED("Failed to wait for vertical blank");
bool success = false;
switch (d->blitMode) {
case DirectVideo:
success = render(d->texture.Get());
break;
case MediaFoundation:
success = dequeueFrame(&d->presentFrame);
break;
default:
success = false;
}
if (!success)
continue;
// Queue to the control's thread for presentation
present.invoke(this, Qt::QueuedConnection);
currentThread->eventDispatcher()->processEvents(QEventLoop::AllEvents);
}
}
// All done, exit render loop
currentThread->quit();
}