PascalDragon,
your explanation fully makes sense to me, as i already suspected event #2 nd #3 (SuspEvent TermEvent: TEvent ... created via TEvent.Create) to be the culprits, as event #1 ((FileEvent: THandle ... created via CreateEvent) did work fine "stand-alone"
EventArray[0] := FileEvent;
WaitResult := WaitForMultipleObjects(1, @EventArray, FALSE, infinite); // with "1" it does work fine
So, yes, i'm convinced it's indeed that handle interpretation of event #2 and #3 - the origin of the issue is that something like:
EventArray[1] := THandle(TermEvent.Handle);
does satisfy the compiler, but is not that what the WaitForMultipleObjects does expect.
For the solution i'd prefer to "retrieve the real handle" using the Tbasiceventstate structure but am unsure how to do that exactly.
Looking into an example usage of it within systhrd.inc, i understand:
it would require a mem New and Dispose, but the assignment to the FHandle property itself uses an CreateEvent here:
plocaleventrec(result)^.FHandle := CreateEvent(EventAttributes, AManualReset, InitialState,n);
Can we do such to if we already have an Event of type TEVent created, and how?
By something like:
plocaleventrec(result)^.FHandle := TermEvent.Handle; // ??? Possible?? Hum
?
marcov.
yes i know that a small example would be useful, but it is not easy because it's buried within a lot of other stuff. Would need to be recreated nearly from the scratch.