File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
src/MySqlConnector/Utilities Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -67,12 +67,14 @@ private TimerQueue()
67
67
68
68
private void Callback ( object ? obj )
69
69
{
70
+ var actionsToBeCalled = new List < Action > ( ) ;
71
+
70
72
lock ( m_lock )
71
73
{
72
74
// process all timers that have expired or will expire in the granularity of a clock tick
73
75
while ( m_timeoutActions . Count > 0 && unchecked ( m_timeoutActions [ 0 ] . Time - Environment . TickCount ) < 15 )
74
76
{
75
- m_timeoutActions [ 0 ] . Action ( ) ;
77
+ actionsToBeCalled . Add ( m_timeoutActions [ 0 ] . Action ) ;
76
78
m_timeoutActions . RemoveAt ( 0 ) ;
77
79
}
78
80
@@ -86,6 +88,11 @@ private void Callback(object? obj)
86
88
UnsafeSetTimer ( delay ) ;
87
89
}
88
90
}
91
+
92
+ foreach ( var action in actionsToBeCalled )
93
+ {
94
+ action ( ) ;
95
+ }
89
96
}
90
97
91
98
// Should be called while holding m_lock.
You can’t perform that action at this time.
0 commit comments