Reputation: 3293
I'm using WaitHandle.WaitAny
that accepts an array of WaitHandle
objects and returns the index of the one event that triggered.
Because the function returns an index, I'd like to keep the index values constant. This causes a problem if a particular slot is empty, because WaitAny
won't accept an array with a null inside.
Is there a cheap (hopefully no-dispose-needed) WaitHandle
subclass that simply never triggers? Then I could substitute any null WaitHandles
I have and keep my handle indexes constant.
(Sure, I could build an AutoResetEvent
and never trigger it but those aren't cheap and will need disposing.)
Or, will I need to build a registration helper and use variable indexes instead?
Upvotes: 0
Views: 43