Using CoWaitForMultipleHandles
Continuing from
Pausing execution of a Thread WITHOUT sleeping?
How do I use the CoWaitForMultipleHandles routine, as Lars Truijens suggested? I found the routine in the SyncObjs unit, however I get "undeclared identifier" when trying to call it? The IDE Insight does not bring anything up either? And yes, I have added SyncObjs to my Uses clause.
I can't see what other info I need to include - however feel more than free to ask for more in开发者_如何学编程fo!
You can't call this function from SyncObjs, because it hasn't been declared in interface section. But TEvent.WaitFor
actually calls CoWaitForMultipleHandles. Did you try it?
And please note its constructor declaration:
{ Specify UseCOMWait to ensure that when blocked waiting for the object
any STA COM calls back into this thread can be made. }
constructor Create(UseCOMWait: Boolean = False);
精彩评论