Home > Uncategorized > Why is the ReaderWriterSlimLock class Disposable?

Why is the ReaderWriterSlimLock class Disposable?

I wanted to know, so I asked an internal Microsoft DL and received this answer. Now I’m posting it incase anyone else wants to know.

 

ReaderWriterLockSlim is disposable because it uses several EventWaitHandle objects internally, and those are disposable, so this gives you a way to dispose them. 

Of course, the finalizer thread will clean up any of these that become unreachable, eventually.  There’s really no need to dispose a ReaderWriterLockSlim unless you’re creating and discarding so many of them that the finalizer thread can’t keep up.

Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

%d bloggers like this: