diff options
author | Petr Onderka <gsvick@gmail.com> | 2016-11-28 19:18:00 +0100 |
---|---|---|
committer | Petr Onderka <gsvick@gmail.com> | 2016-11-28 19:21:17 +0100 |
commit | 9968cfef536000d04b2ade6994392de4e6de06da (patch) | |
tree | 64c68b86cc314f4361d7f70f7447626e1ee8634b /src | |
parent | 2acb29c3e9aeeab5292d6481e8d3bf583ae110ab (diff) | |
download | coreclr-9968cfef536000d04b2ade6994392de4e6de06da.tar.gz coreclr-9968cfef536000d04b2ade6994392de4e6de06da.tar.bz2 coreclr-9968cfef536000d04b2ade6994392de4e6de06da.zip |
Change the type of Task.m_action to Delegate
This makes the code more strongly typed and avoids some casts.
Diffstat (limited to 'src')
-rw-r--r-- | src/mscorlib/src/System/Threading/Tasks/Task.cs | 8 | ||||
-rw-r--r-- | src/mscorlib/src/System/Threading/Tasks/TaskContinuation.cs | 4 | ||||
-rw-r--r-- | src/mscorlib/src/System/Threading/Tasks/future.cs | 2 |
3 files changed, 7 insertions, 7 deletions
diff --git a/src/mscorlib/src/System/Threading/Tasks/Task.cs b/src/mscorlib/src/System/Threading/Tasks/Task.cs index 36f8401a4d..c48d3c456f 100644 --- a/src/mscorlib/src/System/Threading/Tasks/Task.cs +++ b/src/mscorlib/src/System/Threading/Tasks/Task.cs @@ -152,7 +152,7 @@ namespace System.Threading.Tasks private volatile int m_taskId; // this task's unique ID. initialized only if it is ever requested - internal object m_action; // The body of the task. Might be Action<object>, Action<TState> or Action. Or possibly a Func. + internal Delegate m_action; // The body of the task. Might be Action<object>, Action<TState> or Action. Or possibly a Func. // If m_action is set to null it will indicate that we operate in the // "externally triggered completion" mode, which is exclusively meant // for the signalling Task<TResult> (aka. promise). In this mode, @@ -580,7 +580,7 @@ namespace System.Threading.Tasks /// <param name="cancellationToken">A CancellationToken for the Task.</param> /// <param name="creationOptions">Options to customize behavior of Task.</param> /// <param name="internalOptions">Internal options to customize behavior of Task.</param> - internal void TaskConstructorCore(object action, object state, CancellationToken cancellationToken, + internal void TaskConstructorCore(Delegate action, object state, CancellationToken cancellationToken, TaskCreationOptions creationOptions, InternalTaskOptions internalOptions, TaskScheduler scheduler) { m_action = action; @@ -753,7 +753,7 @@ namespace System.Threading.Tasks { get { - Delegate d = (Delegate)m_action; + Delegate d = m_action; return d != null ? d.Method.ToString() : "{null}"; } } @@ -1912,7 +1912,7 @@ namespace System.Threading.Tasks if (AsyncCausalityTracer.LoggingOn && (Options & (TaskCreationOptions)InternalTaskOptions.ContinuationTask) == 0) { //For all other task than TaskContinuations we want to log. TaskContinuations log in their constructor - AsyncCausalityTracer.TraceOperationCreation(CausalityTraceLevel.Required, this.Id, "Task: "+((Delegate)m_action).Method.Name, 0); + AsyncCausalityTracer.TraceOperationCreation(CausalityTraceLevel.Required, this.Id, "Task: " + m_action.Method.Name, 0); } diff --git a/src/mscorlib/src/System/Threading/Tasks/TaskContinuation.cs b/src/mscorlib/src/System/Threading/Tasks/TaskContinuation.cs index 4c035dfddb..b078d27627 100644 --- a/src/mscorlib/src/System/Threading/Tasks/TaskContinuation.cs +++ b/src/mscorlib/src/System/Threading/Tasks/TaskContinuation.cs @@ -305,7 +305,7 @@ namespace System.Threading.Tasks m_options = options; m_taskScheduler = scheduler; if (AsyncCausalityTracer.LoggingOn) - AsyncCausalityTracer.TraceOperationCreation(CausalityTraceLevel.Required, m_task.Id, "Task.ContinueWith: " + ((Delegate)task.m_action).Method.Name, 0); + AsyncCausalityTracer.TraceOperationCreation(CausalityTraceLevel.Required, m_task.Id, "Task.ContinueWith: " + task.m_action.Method.Name, 0); if (Task.s_asyncDebuggingEnabled) { @@ -374,7 +374,7 @@ namespace System.Threading.Tasks return m_task.GetDelegateContinuationsForDebugger(); } - return new Delegate[] { m_task.m_action as Delegate }; + return new Delegate[] { m_task.m_action }; } } diff --git a/src/mscorlib/src/System/Threading/Tasks/future.cs b/src/mscorlib/src/System/Threading/Tasks/future.cs index 39e6ca1d45..d5b2bdb124 100644 --- a/src/mscorlib/src/System/Threading/Tasks/future.cs +++ b/src/mscorlib/src/System/Threading/Tasks/future.cs @@ -447,7 +447,7 @@ namespace System.Threading.Tasks { get { - Delegate d = (Delegate)m_action; + Delegate d = m_action; return d != null ? d.Method.ToString() : "{null}"; } } |