Skip to content
This repository has been archived by the owner on May 21, 2022. It is now read-only.

Commit

Permalink
extensibility...
Browse files Browse the repository at this point in the history
  • Loading branch information
pomma89 committed Apr 1, 2017
1 parent 5a895a4 commit 6158e33
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/CodeProject.ObjectPool/Core/PooledObjectInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ public sealed class PooledObjectInfo
/// </summary>
public int Id { get; internal set; }

/// <summary>
/// Payload which can be used to add custom information to a pooled object.
/// </summary>
public object Payload { get; set; }

/// <summary>
/// Enumeration that is being managed by the pool to describe the object state - primary
/// used to void cases where the resources are being releases twice.
Expand Down
23 changes: 23 additions & 0 deletions src/CodeProject.ObjectPool/ObjectPool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using CodeProject.ObjectPool.Core;
using PommaLabs.Thrower;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;

Expand Down Expand Up @@ -240,6 +241,28 @@ void IObjectPoolHandle.ReturnObjectToPool(PooledObject objectToReturnToPool, boo

#endregion Pool Operations

#region Extensibility

/// <summary>
/// All objects currently stored inside the pool.
/// </summary>
protected IEnumerable<T> PooledObjects
{
get
{
for (var i = 0; i <= _pooledObjects.Length; ++i)
{
var item = _pooledObjects[i];
if (item != null)
{
yield return item;
}
}
}
}

#endregion Extensibility

#region Low-level Pooling

/// <summary>
Expand Down

0 comments on commit 6158e33

Please sign in to comment.