Skip to content

Commit ea464fc

Browse files
committed
Revert the timer change introduced in PowerShell#2640 because it causes race conditions
1 parent 991d607 commit ea464fc

1 file changed

Lines changed: 2 additions & 42 deletions

File tree

src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostUserInterfaceProgress.cs

Lines changed: 2 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
using System;
88
using System.Management.Automation;
99
using Dbg = System.Management.Automation.Diagnostics;
10-
using System.Threading;
1110

1211

1312
namespace Microsoft.PowerShell
@@ -29,12 +28,6 @@ class ConsoleHostUserInterface : System.Management.Automation.Host.PSHostUserInt
2928
// destroy the data structures representing outstanding progress records
3029
// take down and destroy the progress display
3130

32-
if (_progPaneUpdateTimer != null)
33-
{
34-
// Stop update 'ProgressPane' and destroy timer
35-
_progPaneUpdateTimer.Dispose();
36-
_progPaneUpdateTimer = null;
37-
}
3831
if (_progPane != null)
3932
{
4033
Dbg.Assert(_pendingProgress != null, "How can you have a progress pane and no backing data structure?");
@@ -71,41 +64,11 @@ class ConsoleHostUserInterface : System.Management.Automation.Host.PSHostUserInt
7164

7265
if (_progPane == null)
7366
{
74-
// This is the first time we've received a progress record.
75-
// Create a progress pane,
76-
// then show it,
77-
// then create and start timer to update it.
67+
// This is the first time we've received a progress record. Create a progress pane, then show it.
7868

7969
_progPane = new ProgressPane(this);
80-
81-
if (_progPaneUpdateTimer == null && _progPane != null)
82-
{
83-
_progPane.Show(_pendingProgress);
84-
_progPaneUpdateTimer = new Timer( new TimerCallback(ProgressPaneUpdateTimerElapsed), null, UpdateTimerThreshold, Timeout.Infinite);
85-
}
86-
}
87-
}
88-
89-
90-
91-
/// <summary>
92-
///
93-
/// TimerCallback for _progPaneUpdateTimer to update 'ProgressPane' and restart the timer.
94-
///
95-
/// </summary>
96-
97-
private
98-
void
99-
ProgressPaneUpdateTimerElapsed(object sender)
100-
{
101-
if (_progPane != null)
102-
{
103-
_progPane.Show(_pendingProgress);
104-
}
105-
if (_progPaneUpdateTimer != null)
106-
{
107-
_progPaneUpdateTimer.Change(UpdateTimerThreshold, Timeout.Infinite);
10870
}
71+
_progPane.Show(_pendingProgress);
10972
}
11073

11174

@@ -205,9 +168,6 @@ class ConsoleHostUserInterface : System.Management.Automation.Host.PSHostUserInt
205168

206169
private ProgressPane _progPane = null;
207170
private PendingProgress _pendingProgress = null;
208-
// The timer update 'ProgressPane' every 'UpdateTimerThreshold' milliseconds
209-
private Timer _progPaneUpdateTimer;
210-
private const int UpdateTimerThreshold = 100;
211171
}
212172
} // namespace
213173

0 commit comments

Comments
 (0)