From 116aee54f86657fa28b83cfab6a3b95bb2eab893 Mon Sep 17 00:00:00 2001 From: Alessio Parma Date: Sun, 2 Apr 2017 14:54:01 +0200 Subject: [PATCH] timed object pool --- .../ITimedObjectPool.cs | 42 +++++++++++++++++++ src/CodeProject.ObjectPool/TimedObjectPool.cs | 4 +- 2 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 src/CodeProject.ObjectPool/ITimedObjectPool.cs diff --git a/src/CodeProject.ObjectPool/ITimedObjectPool.cs b/src/CodeProject.ObjectPool/ITimedObjectPool.cs new file mode 100644 index 0000000..08605a8 --- /dev/null +++ b/src/CodeProject.ObjectPool/ITimedObjectPool.cs @@ -0,0 +1,42 @@ +// File name: ITimedObjectPool.cs +// +// Author(s): Alessio Parma +// +// The MIT License (MIT) +// +// Copyright (c) 2013-2018 Alessio Parma +// +// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +// associated documentation files (the "Software"), to deal in the Software without restriction, +// including without limitation the rights to use, copy, modify, merge, publish, distribute, +// sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all copies or +// substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +// NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +// OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +namespace CodeProject.ObjectPool +{ + /// + /// A pool where objects are automatically removed after a period of inactivity. + /// + /// + /// The type of the object that which will be managed by the pool. The pooled object have to be + /// a sub-class of PooledObject. + /// +#if NET35 + public interface ITimedObjectPool : IObjectPool +#else + + public interface ITimedObjectPool : IObjectPool +#endif + where T : PooledObject + { + } +} \ No newline at end of file diff --git a/src/CodeProject.ObjectPool/TimedObjectPool.cs b/src/CodeProject.ObjectPool/TimedObjectPool.cs index c966241..e74fd7b 100644 --- a/src/CodeProject.ObjectPool/TimedObjectPool.cs +++ b/src/CodeProject.ObjectPool/TimedObjectPool.cs @@ -25,7 +25,7 @@ using System.Threading; -namespace CodeProject.ObjectPool.Examples.Customizations +namespace CodeProject.ObjectPool { /// /// A pool where objects are automatically removed after a period of inactivity. @@ -34,7 +34,7 @@ namespace CodeProject.ObjectPool.Examples.Customizations /// The type of the object that which will be managed by the pool. The pooled object have to be /// a sub-class of PooledObject. /// - internal class TimedObjectPool : ObjectPool + internal class TimedObjectPool : ObjectPool, ITimedObjectPool where T : PooledObject { private readonly Timer Timer;