v.simi

v.simi

  • NA
  • 1
  • 0

Limited period Singleton in C#

May 20 2004 8:50 AM
Hi, I want to implement a class in C#, such that one instance of that object should be alive if there are threads using it. If no thread is using it, then delete the object. So that the next time, any thread needs this class, it should again be created. It could have been classic singleton, if it would have been alive throughout. But the hitch is that i need to kill/delete the object when i determine that there is nobody else using it... Is Locks/mutex is the way out along with reference count. Could some body throw some light..