当代码从visualstudio 2010调试器终止时,Kinect传感器不会关闭 [英] Kinect sensor does not shutdown when code terminated from the visualstudio 2010 debugger

查看:76
本文介绍了当代码从visualstudio 2010调试器终止时,Kinect传感器不会关闭的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

  我一直在努力寻找相关信息,但未能找到这方面的任何信息。在我的演示中,我使用最新的Kinect for windows sdk(v1.5)。如果我通过终止应用程序(标题
bar中的关闭按钮或esc键)来关闭我的应用程序,我可以运行我的kinect关闭代码。另一方面,如果我使用调试器,则不执行关机代码,因此Kinect保持忙碌状态。这不允许其他应用程序运行Kinect。解决方案是什么?    是否
有一个关闭回调,当调试器从应用程序中取消挂起时可以调用它?

   I have been trying to find relevant information but have failed to find any information in this regard. In my demos, I use the latest Kinect for windows sdk (v1.5). If i close my application by terminating the application (close button in title bar or the esc key), I can run my kinect shutdown code. If on the other hand I use the debugger, the shutdown code is not executed thus Kinect is kept busy. This does not allow other applications to run Kinect. What is the solution for this?  Is there a close callback which can be called when the debugger is unhooked from the application?

谢谢,

MMMovania

MMMovania

推荐答案

将您的主线代码包裹在try / finally阻止并将关闭代码放在finally块中。然后允许应用程序结束而不是简单地退出调试器;也就是说,完成后,禁用所有断点并告诉调试器"go"。
必须优先停止Kinect并在应用程序结束前释放相关资源。

Wrap your main line code in a try/finally block and place your shutdown code in the finally block. Then allow the application to end rather than simply exiting the debugger; that is, when you are done, disable all breakpoints and tell the debugger to "go". The Kinect must be gracefully stopped and related resources released before the application ends.

如果您的应用程序在其中一个框架就绪事件处理程序中崩溃,则崩溃可能会导致崩溃Kinect处于不确定状态,要求在另一个应用程序可以使用它之前进行物理断开连接并重新连接。

If your application is crashing in one of the frame-ready event handlers, the crash may leave the Kinect in an indeterminant state requiring that it be physically disconnected and reconnected before another application can use it.

还要注意,在应用程序上使用调试器超出了正常的应用程序使用范围,因为控制流程可以在没有中间代码知道的情况下中断和转移。可能还有其他情况,Kinect传感器可能会因为无法以编程方式恢复的状态而保留
。 

Also note that using a debugger on an application is outside normal application usage since the flow of control can be interrupted and diverted without intermediate code being aware of it. There may be other scenarios where a Kinect sensor can be left in a bad state that cannot be programmatically recovered. 


这篇关于当代码从visualstudio 2010调试器终止时,Kinect传感器不会关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆