| @@ -1,24 +1,24 | |||||
| 1 | using System; |
|
1 | using System; | |
| 2 |
|
2 | |||
| 3 | namespace Implab { |
|
3 | namespace Implab { | |
| 4 |
public |
|
4 | public class ObjectPoolWrapper<T> : IDisposable { | |
| 5 | readonly T m_value; |
|
5 | readonly T m_value; | |
| 6 | readonly ObjectPool<T> m_pool; |
|
6 | readonly ObjectPool<T> m_pool; | |
| 7 |
|
7 | |||
| 8 | internal ObjectPoolWrapper(T value, ObjectPool<T> pool) { |
|
8 | internal ObjectPoolWrapper(T value, ObjectPool<T> pool) { | |
| 9 | m_value = value; |
|
9 | m_value = value; | |
| 10 | m_pool = pool; |
|
10 | m_pool = pool; | |
| 11 | } |
|
11 | } | |
| 12 |
|
12 | |||
| 13 | public T Value { |
|
13 | public T Value { | |
| 14 | get { return m_value; } |
|
14 | get { return m_value; } | |
| 15 | } |
|
15 | } | |
| 16 |
|
16 | |||
| 17 | #region IDisposable implementation |
|
17 | #region IDisposable implementation | |
| 18 | public void Dispose() { |
|
18 | public void Dispose() { | |
| 19 | m_pool.Release(m_value); |
|
19 | m_pool.Release(m_value); | |
| 20 | } |
|
20 | } | |
| 21 | #endregion |
|
21 | #endregion | |
| 22 | } |
|
22 | } | |
| 23 | } |
|
23 | } | |
| 24 |
|
24 | |||
General Comments 0
You need to be logged in to leave comments.
Login now
