What does BlockingCollection.Dispose actually do?
Share
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.
This allows the internal wait handles to be disposed of properly.
BlockingCollection<T>, internally, uses a pair of event wait handles, which in turn have an associated nativeHANDLE.Specifically,
BlockingCollection<T>.Dispose()releases these two handles back to the operating system, by eventually (through SemaphoreSlim->ManualResetEvent) calling the native CloseHandle method on the two nativeHANDLEinstances.