in reply to Re^2: multiple infinitive loops
in thread multiple infinitive loops

I don't know anything about these scripting/locator things, but a quick look at the MSDN Library shows that NextEvent accepts a timeout. Therefore, a simple solution is:

use constants TIMEOUT => 50; use constants wbemErrTimedOut => 0x80043001; while (1) { $o1 = $h1->NextEvent(TIMEOUT); ProcessEvent1($h1, $o1) if ($o1 != wbemErrTimedOut); $o2 = $h2->NextEvent(TIMEOUT); ProcessEvent2($h2, $o2) if ($o2 != wbemErrTimedOut); }

Replies are listed 'Best First'.
Re^4: multiple infinitive loops
by ozkaa (Acolyte) on Oct 06, 2004 at 17:10 UTC
    yes, but I don't want it to timeout because its a critical thing to keep on monitoring the processes

    Oscar
      It depends on how NextEvent works. If it just gets something from a queue (likely), you won't lose anything. It'll just get the event the next pass through the loop.