From 982ab99b45c044952d3e060642fb56d12dbe994b Mon Sep 17 00:00:00 2001 From: Ben Adams Date: Mon, 28 Dec 2015 23:02:41 +0000 Subject: [PATCH] Make callback adapters readonly --- .../Infrastructure/KestrelThread.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Microsoft.AspNet.Server.Kestrel/Infrastructure/KestrelThread.cs b/src/Microsoft.AspNet.Server.Kestrel/Infrastructure/KestrelThread.cs index 4974ba7a9f..4769d62d6e 100644 --- a/src/Microsoft.AspNet.Server.Kestrel/Infrastructure/KestrelThread.cs +++ b/src/Microsoft.AspNet.Server.Kestrel/Infrastructure/KestrelThread.cs @@ -24,11 +24,11 @@ namespace Microsoft.AspNet.Server.Kestrel // otherwise it needs to wait till the next pass of the libuv loop private const int _maxLoops = 8; - private static Action _threadCallbackAdapter = (callback, state) => ((Action)callback).Invoke((KestrelThread)state); - private static Action _socketCallbackAdapter = (callback, state) => ((Action)callback).Invoke((SocketOutput)state); - private static Action _tcsCallbackAdapter = (callback, state) => ((Action>)callback).Invoke((TaskCompletionSource)state); - private static Action _listenerPrimaryCallbackAdapter = (callback, state) => ((Action)callback).Invoke((ListenerPrimary)state); - private static Action _listenerSecondaryCallbackAdapter = (callback, state) => ((Action)callback).Invoke((ListenerSecondary)state); + private static readonly Action _threadCallbackAdapter = (callback, state) => ((Action)callback).Invoke((KestrelThread)state); + private static readonly Action _socketCallbackAdapter = (callback, state) => ((Action)callback).Invoke((SocketOutput)state); + private static readonly Action _tcsCallbackAdapter = (callback, state) => ((Action>)callback).Invoke((TaskCompletionSource)state); + private static readonly Action _listenerPrimaryCallbackAdapter = (callback, state) => ((Action)callback).Invoke((ListenerPrimary)state); + private static readonly Action _listenerSecondaryCallbackAdapter = (callback, state) => ((Action)callback).Invoke((ListenerSecondary)state); private KestrelEngine _engine; private readonly IApplicationLifetime _appLifetime;