首页 \ 问答 \ 有一个已创建的线程,或在必要时创建线程(Have an already created thread at all time or create the thread when necessary)

有一个已创建的线程,或在必要时创建线程(Have an already created thread at all time or create the thread when necessary)

我正在使用用于小型USB设备的用户模式驱动程序。 我的usb读取循环应该非常敏感,它执行的操作应该非常小(不一定是原子的)。 就像内核模式驱动程序中的中断服务程序一样。 在一个处理中,我需要创建一个线程并将一些参数传递给该读取循环内的该线程。

所以我需要知道该操作的确切上限。 它不会超过200毫秒,或类似的东西。

下一个选择是在设备初始化时间(探测时间)进行线程初始化,然后休眠该线程,直到我从读取线程发出信号。 但在这种情况下,线程始终在运行,而且成本很高。

什么是最好的选择? 我的平台是linux,他们说在linux中,线程创建的操作非常短。 我需要决定什么是最好的。 保持线程始终处于活动状态或在必要时创建线程。


I'm working with a user mode driver for small scale USB devices. My usb reading loop should be very responsive and operations it performs should be very small ( not necessary to be atomic). Like an interrupt service routine in a kernel mode driver. In one processing I need to create a thread and pass some parameters to that thread inside that reading loop.

So I need to know the exact upper limit of that operation. It will not take more than 200mS , or something like that.

Next alternative is to do the thread initialization at the device initialization time ( probing time ) and then sleep that thread waiting till I signal it from the reading thread. But in this scenario the thread is always running and it would be costly.

What is the best option ? My platform is linux, and they said in linux, thread creation have very short operation. I need to decide what is best. Keep the thread alive at all-time or create the thread when necessary.


原文:https://stackoverflow.com/questions/43780187
更新时间:2023-10-31 14:10

最满意答案

该菜单需要jQuery ,但它还需要一个自定义版本的modernizer 。 该版本的现代化器包含在下载中。 确保加载jquery.dlmenu.js 之前加载了jquery.dlmenu.js ,当然要确保在这两者之前加载jquery


The menu requires jQuery, but it also requires a custom version of modernizer. That version of modernizer is included in the download. Make sure you load the modernizr.custom.js before you load jquery.dlmenu.js, and of course make sure you load jquery before both of those.

相关问答

更多
  • 你确定blockUI插件脚本实际上被加载吗? Are you sure that the blockUI plugin script is actually being loaded?
  • __defineGetter__是一种定义属性“getter”函数的旧的专有方法。 如果您使用的库依赖于它,则不能在不支持它的JavaScript引擎上使用它。 为属性定义getter函数的现代标准方法不使用该语法。 也许你可以使用更新的库版本。 目前有两种/三种标准方式,另一种是: 在对象初始值 set上使用get和set函数: var obj = { get foo() { return /*...foo value...*/; }, set foo(v) { ...
  • 一些小问题: mootools中的document.id('step-1')应该是document.id('step-1') - 两者都返回一个元素,但是mootools也会在较旧的IE中安装原型方法,这些方法不会从Element原型继承而且会设置元素uid和存储。 如果在IE6,7和8中没有这样做,这将产生您发布的错误。 第二 当你收到这个错误时,你真的需要打破你所做的调用,看看它在调试失败的链中的位置。 我建议将引用保存到var中并在之后应用该方法。 第三 你得到多个元素并在集合上调用.set() - ...
  • 我的问题是在easyui库之后包括jquery库,当我首先包含jquery问题解决了。 My problem was including jquery library after the easyui library when I include jquery first the problem is solved.
  • 您是否通过访问slimScroll网站在本地遇到此问题? 当我使用IE9访问该网站时,我实际上得到了同样的错误。 查看控制台有以下消息: SEC7112: Script from https://raw.github.com/rochal/jQuery-slimScroll/master/slimScroll.js was blocked due to mime type mismatch javascript文件确实包含在html中,如下所示: