File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed
src/libraries/System.Private.CoreLib/src/System/Threading/Tasks Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -120,7 +120,7 @@ public class Task : IAsyncResult, IDisposable
120120
121121 internal static int s_taskIdCounter ; // static counter used to generate unique task IDs
122122
123- private volatile int m_taskId ; // this task's unique ID. initialized only if it is ever requested
123+ private int m_taskId ; // this task's unique ID. initialized only if it is ever requested
124124
125125 internal Delegate ? m_action ; // The body of the task. Might be Action<object>, Action<TState> or Action. Or possibly a Func.
126126 // If m_action is set to null it will indicate that we operate in the
@@ -1179,7 +1179,7 @@ public int Id
11791179 {
11801180 get
11811181 {
1182- if ( m_taskId == 0 )
1182+ if ( Volatile . Read ( ref m_taskId ) == 0 )
11831183 {
11841184 int newId = NewId ( ) ;
11851185 Interlocked . CompareExchange ( ref m_taskId , newId , 0 ) ;
You can’t perform that action at this time.
0 commit comments