view->SetSize() reports thread safety errors
Hi, I was trying to integrate Noesis sample into my project and faced several issues in regard to multithreading.
The code is pretty much the same as in integration sample, except I initialize Noesis in main thread, but create/update view in another one.
It reports that content is being owned by another thread even though the view methods are invoked in the same thread where view was created.
I found out that I can get rid of the error by moving providers to the view creation scope
which I believe implies that views share a common state.
Is it true or is it just an ownership issue and it is safe to assume there is no shared state and views are completely isolated from each other?
If the latter, is it possible to disable thread safety validation? I was going to update many views in fibers-like jobs system and binding views to specific threads would cause significant overhead with performance implications.
The code is pretty much the same as in integration sample, except I initialize Noesis in main thread, but create/update view in another one.
Code: Select all
void noesisUpdate()
{
if (noesisView == nullptr)
{
noesisView = Noesis::GUI::CreateView(Noesis::GUI::LoadXaml<Noesis::UserControl>("Settings.xaml"));
noesisView->SetFlags(Noesis::RenderFlags_PPAA | Noesis::RenderFlags_LCD);
noesisView->GetRenderer()->Init(renderDevice);
}
static uint64_t startTime = Noesis::HighResTimer::Ticks();
uint64_t time = Noesis::HighResTimer::Ticks();
noesisView->SetSize(vk->swapchain.extent().width, vk->swapchain.extent().height);
noesisView->Update(Noesis::HighResTimer::Seconds(time - startTime));
noesisView->GetRenderer()->UpdateRenderTree();
noesisView->GetRenderer()->RenderOffscreen();
noesisView->GetRenderer()->Render();
}
I found out that I can get rid of the error by moving providers to the view creation scope
Code: Select all
Noesis::Ptr<Noesis::XamlProvider> xamlProvider = *new NoesisApp::EmbeddedXamlProvider(xamls);
Noesis::Ptr<Noesis::FontProvider> fontProvider = *new NoesisApp::EmbeddedFontProvider(fonts);
NoesisApp::SetThemeProviders(xamlProvider, fontProvider);
Is it true or is it just an ownership issue and it is safe to assume there is no shared state and views are completely isolated from each other?
If the latter, is it possible to disable thread safety validation? I was going to update many views in fibers-like jobs system and binding views to specific threads would cause significant overhead with performance implications.
Re: view->SetSize() reports thread safety errors
There is no shared state between Views, they are completely isolated. But I think that the warnings are coming from the fact that the theme is being loaded in the main thread and there must be resources inside it that are not properly sealed.
Could you please open a ticket about this?
We also have plans to expose API (and #define) to disable these checks. For now, you can easily do this by filtering them in your log callback.
Could you please open a ticket about this?
We also have plans to expose API (and #define) to disable these checks. For now, you can easily do this by filtering them in your log callback.
Re: view->SetSize() reports thread safety errors
Great, thanks for confirming!
I'll create a ticket.
I'll create a ticket.
Who is online
Users browsing this forum: Ahrefs [Bot] and 1 guest