哪些客户端正在使用驱动程序?
我需要其中一个驱动程序处于空闲状态(已加载到设备上,但根本没有使用)来获取一些统计信息。我需要确保没有线程/客户端正在使用该驱动程序。我想看看是否有办法实现此目的,以便我可以以编程方式终止/停用正在使用驱动程序的客户端/线程(如果有)以确保其空闲。请建议。
I need one of the drivers to be idle (loaded on the device, but not being used at all) to get some statistics. I need to make sure that no threads/clients are using the driver. I am trying to see if there is a way to achieve this so I can programatically kill/deactivate the clients/threads, if any, that are using the driver to make sure it is idle. Please suggest.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您使用的是 Windows Embedded Compact 7,则可以使用可插入到您正在测试的驱动程序前面的筛选驱动程序。过滤驱动程序可以阻止任何呼叫到达您的驱动程序,从而有效地让您的驱动程序空闲。
过滤器驱动程序是 Compact 7 中的一项新功能,因此如果您使用的是旧版本,它不会对您有帮助。请参阅http://embedded101.com/Articles/ Embedded101Article/tabid/75/ArticleId/28/Filter-Device-Drivers.aspx 了解过滤器驱动程序的介绍。
If you are using Windows Embedded Compact 7, you might be able to use a filter driver which can be inserted in front of the driver you are testing. The filter driver can prevent any calls from reaching your driver, hence effectively leaving your driver idle.
Filter drivers are a new feature in Compact 7, so it will not help you if you are using an older version. See http://embedded101.com/Articles/Embedded101Article/tabid/75/ArticleId/28/Filter-Device-Drivers.aspx for an intro to filter drivers.
我不完全明白。如果您编写了驱动程序,那么您就是 的看门人驱动程序的每个入口点。您可以允许/禁止客户端以您想要的方式调用(例如信号量、互斥体、布尔标志等)。您会知道是否有人正在“使用”该驱动程序,因为也许有人调用了“打开”而不是“关闭”。或者像 Read 或 Write 这样的方法已经进入但尚未退出。
I don't fully understand. If you wrote the driver, you are the gatekeeper to every entry point into the driver. You can allow/disallow clients to call in however you want (e.g. semaphore, mutex, boolean flag, etc). You would know if anyone is "using" the driver because maybe someone called Open and not Close. Or a method like Read or Write would have been entered and not yet exited.