Why isn’t there an AutoResetEventSlim class in BCL?
Can it be simulated using ManualResetEventSlim?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
ManualResetEventandManualResetEventSlimboth are designed so that they remained signaled after calling. This is typically for a very different scenario thanAutoResetEvent.AutoResetEventimmediately returns to the unsignaled state after usage, which is typically used for a different set of scenarios. From AutoResetEvents documentation:ManualResetEvent(andSlim) are typically used, however, for a scenario where:Since
AutoResetEventis most commonly used in scenarios where there are multiple threads sharing a resource, wait times typically would not be extremely short.ManualResetEventSlim, however, is really only intended when you know, in advance, the wait time is very short. If your wait time is not going to be very short, then you should useManualResetEventinstead. See the documentation on the difference between MRE and MRES for details.When your wait times are longer (which would be the normal scenario with
AutoResetEvent), the “slim” version is actually worse, as it reverts to using a wait handle.