Click to See Complete Forum and Search --> : SetEvent stack?


leojose
November 24th, 2005, 04:35 AM
Hi all,

I am using a SetEvent -> WaitForSingleObjectEx combination to process events and execute them sequentially. The loop or thread that sets events using SetEvent will be fast and random, while the thread that handles these events using WaitForSingleObjectEx api, will move at a fixed pace in trying to keep up with events received.
I would like to know what is the stack level of SetEvent? How many events can it buffer before running low on space or maybe overwritting previous contents?

wildfrog
November 24th, 2005, 04:48 AM
I would like to know what is the stack level of SetEvent?Not quite sure what you mean. You don't 'stack' event objects, you either 'set' it, 'reset' it og 'waitfor' it (in other words, it's one level deep).
How many events can it buffer before running low on space or maybe overwritting previous contents?That depends on how you've implemented the 'event messaging' mechanism.

- petter

leojose
November 24th, 2005, 06:04 AM
you either 'set' it, 'reset' it og 'waitfor' it (in other words, it's one level deep).

Is it just one level deep?
So what happens if a SetEvent(event) is fired say 20 times even before the WaitForSingleObject(event) completes one loop? Won't the latter loop 20 times over?

leojose
November 26th, 2005, 05:18 AM
You were right wildfrog...your reply prompted me to re-check and I noticed that it actually was just 1 level deep!
I changed the logic of my code a little bit to take care of this.
Thanks ;)