In my server application (written in C#), I need to create a pool of same type of objects. I pull an object from pool when I need, and it goes back to pool when it is no longer needed. Mechanism needs to be thread safe since different threads will be asking and submitting these objects. I understand that frequently locking something to make thread-safe has an adverse effect on application performance. Can you suggest a design by which I can even avoid explicit locks?
Please can you suggest the way I can accomplish above? Ability to resize the pool (create additional if running short of objects) would be a great add-on.
Thanks in advance...