问题标签 [waitforsingleobject]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
delphi - Should I lock the filter state during a DirectShow push source filter FillBuffer() call?
I have a DirectShow filter written Delphi 6 using the DSPACK component library. Currently I lock the filter state using the sync obj created for that purpose at the top of the FillBuffer() call and release it at the end (inside the finally section of a try/finally construct). Since the FillBuffer() call can block while waiting for new data to send out, via a WaitForSingleObject() call that is released by the thread that fulfills the data generation task, is this a bad idea? I am concerned that if the FillBuffer() call blocks for a (relatively) long time, this could affect negatively my filter or the entire filter graph.
asynchronous - 在循环中使用 WaitForMultipleObjects 而不是 WaitForSingleObject 有什么好处?
我有一个vector<HANDLE>
. 我想等他们全部完成。我不想将它们复制到数组中。无论如何这样做并使用WaitForMultpleObjects
,而不是WaitForSingleObject
在循环中使用(如果有的话)有什么好处?
谢谢!
winapi - “机器睡眠”+ WaitForSingleObject + 有限超时
这里有一个奇怪的问题——但是:
如果我在具有 20 分钟超时的互斥锁上使用 WaitForSingleObject。然后,机器在等待时进入睡眠模式(或休眠)...... 12 小时后醒来——我对 WaitForSingleObject 的调用会超时吗?或者计时器会随着机器睡眠而暂停?
c++ - 等待单对象函数使用
我正在使用WaitForSingleObject()
函数在我的程序中实现等待。
我们都知道这个函数会在指定的时间内等待事件发出信号。
但是我想知道当事件在进入这个调用之前已经单打时会发生什么,那时是等待意志fail(WAIT_FAILED)
吗?请以适当的理由回答这个问题。我想更深入地了解这一点。
events - Win 8 Metro 模式:WaitForSingleObjectEx 失败
我正在尝试在这样的地铁模式下实现类似睡眠(毫秒)的行为
它打印:WaitForSingleObjectEx, failed ...Err: WAIT_FAILED
: -->> 0 Windows 文档说GetLastError
也支持 Metro 模式,但系统错误代码说只有桌面模式……这很奇怪!和 0 表示Success
但它没有!任何人都可以帮助我至少GetLastError
..我知道这是简单的实现,我也为桌面模式做了类似的事情..想知道有什么问题!
>>>>>>>>> 编辑 <<<<<<<<
不确定 GetLastError,但只需实现一种Sleep
, 与
c++ - 在应用程序之间的消息中重复 WaitForSingleObject
我在 C(生产者和消费者)中创建了两个程序,它们相互发送消息(使用 CreateEvent、SetEvent 和 WaitForSingleObject)
我为每个程序实现一个线程以使用 WaitForSingleObject(myEvent, INFINITE) 等待消息来管理此消息
我将 WaitForSingleObject 放入循环中以重复并及时获取许多消息。
这在第一次工作正常,但其他时候 WaitForSingleObject 不等待消息,左侧代码在不定式循环中运行(再次包括 WaitForSingleObject)
我测试删除了两个程序的 CloseHandle(myEvent) 但没有结果
怎么了?谢谢
c++ - 如何使进程 B 仅在进程 A 处于活动状态时运行
我有一个启动另一个进程 B 的进程 A。
当前进程 B 在退出之前等待进程“A”发出的信号(WaitForSingleObject),一旦设置了信号,进程 B 就会退出。但是,当进程 A 意外终止或崩溃时,我最终会发现进程 B 仍在运行。除非进程 A 崩溃,否则如何让 B 无限期地等待信号?换句话说.. 进程 B 应该只在进程 A 运行之前保持活动状态。谢谢
winapi - 使用 timeSetEvent 和 SetWaitableTimer 解析 WaitForSingleObject
我正在使用 Win32 多媒体计时器在发送大量 UDP 数据包之间设置延迟,但我发现由此产生的延迟比它应该的要长得多。大约 40 毫秒的延迟有时接近 1000 毫秒,即使在使用 Windows Miltimedia 计时器并提高计时器分辨率时也是如此。下面是我使用的代码的简化版本:
我怀疑问题是 Windows7 不再保证在由事件而不是回调发出信号时解决计时器,但我不愿意使用后者。任何人都知道为什么即使是单线程测试用例中所谓的高分辨率计时器也如此不准确?
c++ - 直到 WaitForSingleObject 返回的时间
有没有办法知道从我调用 WaitForSingleObject 函数到它返回经过了多少时间?
或者知道的唯一方法是使用某种计时器?
winapi - 为什么这种同步不起作用?
我有这个代码:
我希望交替调用这两个函数 (GenerateNumbers
和)。DisplayNumbers
但是,在启动时,GenerateNumbers
它会被调用两次,然后它只是等待。该DisplayNumbers
方法永远不会被调用。有人可以解释造成这种僵局的原因吗?