AutoResetEvent puzzlement


I’ve been having a problem with AutoResetEvents, more a puzzlement really. They are synonymous with Win32 Event’s as I understand them.

So in Win32 land, assuming I have multiple threads waiting on this event, from a main app thread if I repeatedly set this event say 8 times, as the event is kind of ref counted, my waiting threads will wake up, do something and continue waiting on the event, exactley 8 times, or rather, whatever work those waiting threads do will be done exactley 8 times, by x number of those waiting threads.

This is not the behaviour I’ve seen when translated into .NET / C#. My waiting threads get activated roughly have the number of times the event is “set”.

It could be me, and I haven’t fully investigated it yet, hence the puzzlement

Published by

Phil Harding

SharePoint Consultant, Developer, Father, Husband and Climber.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.