Skip to content

Commit bf6a32a

Browse files
committed
Remove PSES force event handling hook
1 parent 57f3bcd commit bf6a32a

File tree

1 file changed

+1
-17
lines changed

1 file changed

+1
-17
lines changed

PSReadLine/ReadLine.cs

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,6 @@ internal static PSKeyInfo ReadKey()
197197
// - a key is pressed
198198
// - the console is exiting
199199
// - 300ms - to process events if we're idle
200-
// - processing of events is requested externally
201200
// - ReadLine cancellation is requested externally
202201
handleId = WaitHandle.WaitAny(_singleton._requestKeyWaitHandles, 300);
203202
if (handleId != WaitHandle.WaitTimeout && handleId != EventProcessingRequested)
@@ -655,10 +654,6 @@ private PSConsoleReadLine()
655654
_savedCurrentLine = new HistoryItem();
656655
_queuedKeys = new Queue<PSKeyInfo>();
657656

658-
// Initialize this event handler early because it could be used by PowerShell
659-
// Editor Services before 'DelayedOneTimeInitialize' runs.
660-
_forceEventWaitHandle = new AutoResetEvent(false);
661-
662657
string hostName = null;
663658
// This works mostly by luck - we're not doing anything to guarantee the constructor for our
664659
// singleton is called on a thread with a runspace, but it is happening by coincidence.
@@ -849,7 +844,7 @@ private void DelayedOneTimeInitialize()
849844
_singleton._readKeyWaitHandle = new AutoResetEvent(false);
850845
_singleton._keyReadWaitHandle = new AutoResetEvent(false);
851846
_singleton._closingWaitHandle = new ManualResetEvent(false);
852-
_singleton._requestKeyWaitHandles = new WaitHandle[] {_singleton._keyReadWaitHandle, _singleton._closingWaitHandle, _defaultCancellationToken.WaitHandle, _singleton._forceEventWaitHandle};
847+
_singleton._requestKeyWaitHandles = new WaitHandle[] {_singleton._keyReadWaitHandle, _singleton._closingWaitHandle, _defaultCancellationToken.WaitHandle};
853848
_singleton._threadProcWaitHandles = new WaitHandle[] {_singleton._readKeyWaitHandle, _singleton._closingWaitHandle};
854849

855850
// This is for a "being hosted in an alternate appdomain scenario" (the
@@ -869,17 +864,6 @@ private void DelayedOneTimeInitialize()
869864
_singleton._readKeyThread.Start();
870865
}
871866

872-
/// <summary>
873-
/// Used by PowerShellEditorServices to force immediate
874-
/// event handling during the <see cref="PSConsoleReadLine.ReadKey" />
875-
/// method. This is not a public API, but it is part of a private contract
876-
/// with that project.
877-
/// </summary>
878-
private static void ForcePSEventHandling()
879-
{
880-
_singleton._forceEventWaitHandle.Set();
881-
}
882-
883867
private static void Chord(ConsoleKeyInfo? key = null, object arg = null)
884868
{
885869
if (!key.HasValue)

0 commit comments

Comments
 (0)