Windows Phone (Mango) 渲染线程被阻止
我正在开发一个应用程序,似乎花费了令人不安的时间来获取数据(30-40 秒),因此我设置了一个低调的分析器来检查并查看问题出在哪里。
说实话我还是不知道问题出在哪里。我发现我可以快速从服务中获取数据(5-6 秒内),将其全部美化以供显示,然后发送一条消息来向我的 ViewModel 发出信号,表明数据已准备好显示(使用 MVVM Light Messaging)。 ..然后我的渲染线程将阻塞 10-40 秒。
这就是我不明白的事情。我的 UI 线程运行得很好...用页面上的自定义进度动画来制作它的动画效果。我通过 Messenger 发送的对象非常小(只有几个布尔值,指示可以在哪里找到数据及其外观)。
但是渲染线程(响应屏幕触摸事件的线程)完全被阻塞。当线程最终解除阻塞时,我会同时触摸以移动我的枢轴控件和所有触摸数据寄存器。
我查看了 Windows Phone 性能分析,认为问题出在哪里是非常明显的(我想我会看到 CPU 峰值达到 100%,并且我可以追踪到导致我崩溃的功能),但事实并非如此似乎没有注意到任何异常,通常的 UI 线程占据了显示,但没有什么异常。
我完全糊涂了。 Mango 中是否有一些我需要注意的东西会严重阻塞我的渲染线程?
I'm working on an application and it seemed like it was taking a disturbing amount of time for me to get my data (30-40 seconds), so I set up a low key profiler to check and see where the problem was.
I honestly still don't know where the problem is. I found that I was getting my data back from my service quickly (within 5-6 seconds), prettifying it all up for display and then send a message to signal my ViewModel that the data was ready for display (using MVVM Light Messaging)... and then my render thread would block for 10-40 seconds.
And that's the thing I don't get. My UI Thread is doing just fine... animating it's little heart out with the custom progress animation I have on the page. And the object I'm sending through the Messenger is super-small (just a couple of booleans indicating where the data can be found and what it looks like).
But the render thread (which is the one that responds to the screen touch events) is totally blocked. I touch to move my pivot control and all the touch data registers at one time when the thread finally unblocks.
I went to the Windows Phone Performance Analysis, figuring that it would be super-obvious what the problem would be (I figured I'd see the CPU spike to 100% and I could track down the functions that were killing me) But it doesn't seem to notice anything unusual, the usual UI Thread hogging the show, but nothing out of the ordinary.
I am utterly befuddled. Is there something in Mango that I need to be aware of that will block my render thread so severely?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想我们需要看一些代码。另请注意,GetIsNetworkAvailable 可能需要 20 秒以上才能返回结果。您提到您正在获取数据,因此也许您正在 UI 线程上调用此函数。
I guess we need to see some code. Also be aware that GetIsNetworkAvailable can take over 20 seconds to return a result. You mentioned you were getting data so perhaps you are calling this function on the UI thread.