Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
/ corefx Public archive

Commit

Permalink
Don't capture AsyncLocals into ODBC Global Timers (#26066)
Browse files Browse the repository at this point in the history
  • Loading branch information
benaadams authored and stephentoub committed Jan 31, 2018
1 parent ec353e2 commit 4852538
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,11 @@ internal virtual DbConnectionPoolGroupProviderInfo CreateConnectionPoolGroupProv
}

private Timer CreatePruningTimer()
{
TimerCallback callback = new TimerCallback(PruneConnectionPoolGroups);
return new Timer(callback, null, PruningDueTime, PruningPeriod);
}
=> ADP.UnsafeCreateTimer(
new TimerCallback(PruneConnectionPoolGroups),
null,
PruningDueTime,
PruningPeriod);

protected DbConnectionOptions FindConnectionOptions(DbConnectionPoolKey key)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -382,9 +382,11 @@ internal void Clear()
}

private Timer CreateCleanupTimer()
{
return (new Timer(new TimerCallback(this.CleanupCallback), null, _cleanupWait, _cleanupWait));
}
=> ADP.UnsafeCreateTimer(
new TimerCallback(CleanupCallback),
null,
_cleanupWait,
_cleanupWait);

private DbConnectionInternal CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
{
Expand Down
3 changes: 3 additions & 0 deletions src/System.Data.Odbc/src/System.Data.Odbc.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
<Compile Include="$(CommonPath)\System\Data\Common\AdapterUtil.cs">
<Link>Common\System\Data\Common\AdapterUtil.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\System\Data\Common\AdapterUtil.Drivers.cs">
<Link>System\Data\Common\AdapterUtil.Drivers.cs</Link>
</Compile>
<Compile Include="Common\System\Data\Common\AdapterUtil.Odbc.cs" />
<Compile Include="Common\System\Data\Common\DbConnectionOptions.cs" />
<Compile Include="$(CommonPath)\System\Data\Common\DbConnectionOptions.Common.cs">
Expand Down

0 comments on commit 4852538

Please sign in to comment.