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

Commit

Permalink
Add System.Threading.Timer package refrence,support Timer for .NET St…
Browse files Browse the repository at this point in the history
…andard 1.0
  • Loading branch information
ULiiAn committed Jun 30, 2017
1 parent 8aa2562 commit d1c2607
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
12 changes: 12 additions & 0 deletions src/CodeProject.ObjectPool/CodeProject.ObjectPool.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,16 @@
<Reference Include="Microsoft.CSharp" />
<Reference Include="System" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netstandard1.0'">
<PackageReference Include="System.Threading.Timer">
<Version>4.3.0</Version>
</PackageReference>
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netstandard1.3'">
<PackageReference Include="System.Threading.Timer">
<Version>4.3.0</Version>
</PackageReference>
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions src/CodeProject.ObjectPool/EvictorTimer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

namespace CodeProject.ObjectPool
{
#if !NETSTD10

public class EvictorTimer : IEvictionTimer, IDisposable
{
#if !NET35
Expand Down Expand Up @@ -114,5 +114,5 @@ protected virtual void Dispose(bool disposing)
}
}
}
#endif

}
6 changes: 2 additions & 4 deletions src/CodeProject.ObjectPool/ObjectPool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,10 @@ public ObjectPool(int maximumPoolSize, Func<T> factoryMethod, IEvictionTimer tim

// Creating a new instance for the Diagnostics class.
Diagnostics = new ObjectPoolDiagnostics();


#if !NETSTD10

// Creating a new instance for the EvictorTimer class.
this._timer = timer ?? new EvictorTimer();
#endif

this.StartEvictor(evictionConfig);
}

Expand Down
5 changes: 1 addition & 4 deletions src/CodeProject.ObjectPool/TimedObjectPool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
// 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.

#if !NETSTD10

using CodeProject.ObjectPool.Core;
using System;
Expand Down Expand Up @@ -188,6 +187,4 @@ private void UpdateTimeout()

#endregion Core Methods
}
}

#endif
}

0 comments on commit d1c2607

Please sign in to comment.