[MWB]Fix helper process termination issue in service mode (#36892)
* [MWB] Changed to suppress the flow of the execution context * Fix build after merge * [MWB] Fix helper process termination issue in service mode * Add some comments
This commit is contained in:
Родитель
318cb32d13
Коммит
422096b907
|
@ -262,6 +262,10 @@ namespace MouseWithoutBorders
|
||||||
|
|
||||||
new Task(() =>
|
new Task(() =>
|
||||||
{
|
{
|
||||||
|
// SuppressFlow fixes an issue on service mode, where the helper process can't get enough permissions to be started again.
|
||||||
|
// More details can be found on: https://github.com/microsoft/PowerToys/pull/36892
|
||||||
|
using var asyncFlowControl = ExecutionContext.SuppressFlow();
|
||||||
|
|
||||||
System.Threading.Thread thread = Thread.CurrentThread;
|
System.Threading.Thread thread = Thread.CurrentThread;
|
||||||
thread.Name = $"{nameof(SendClipboardDataUsingTCP)}.{thread.ManagedThreadId}";
|
thread.Name = $"{nameof(SendClipboardDataUsingTCP)}.{thread.ManagedThreadId}";
|
||||||
Thread.UpdateThreads(thread);
|
Thread.UpdateThreads(thread);
|
||||||
|
@ -386,6 +390,10 @@ namespace MouseWithoutBorders
|
||||||
|
|
||||||
new Task(() =>
|
new Task(() =>
|
||||||
{
|
{
|
||||||
|
// SuppressFlow fixes an issue on service mode, where the helper process can't get enough permissions to be started again.
|
||||||
|
// More details can be found on: https://github.com/microsoft/PowerToys/pull/36892
|
||||||
|
using var asyncFlowControl = ExecutionContext.SuppressFlow();
|
||||||
|
|
||||||
System.Threading.Thread thread = Thread.CurrentThread;
|
System.Threading.Thread thread = Thread.CurrentThread;
|
||||||
thread.Name = $"{nameof(ConnectAndGetData)}.{thread.ManagedThreadId}";
|
thread.Name = $"{nameof(ConnectAndGetData)}.{thread.ManagedThreadId}";
|
||||||
Thread.UpdateThreads(thread);
|
Thread.UpdateThreads(thread);
|
||||||
|
|
|
@ -72,6 +72,10 @@ namespace MouseWithoutBorders
|
||||||
|
|
||||||
private static void HelperThread()
|
private static void HelperThread()
|
||||||
{
|
{
|
||||||
|
// SuppressFlow fixes an issue on service mode, where the helper process can't get enough permissions to be started again.
|
||||||
|
// More details can be found on: https://github.com/microsoft/PowerToys/pull/36892
|
||||||
|
using var asyncFlowControl = System.Threading.ExecutionContext.SuppressFlow();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
while (true)
|
while (true)
|
||||||
|
|
|
@ -379,6 +379,10 @@ namespace MouseWithoutBorders.Class
|
||||||
|
|
||||||
private static void InputCallbackThread()
|
private static void InputCallbackThread()
|
||||||
{
|
{
|
||||||
|
// SuppressFlow fixes an issue on service mode, where the helper process can't get enough permissions to be started again.
|
||||||
|
// More details can be found on: https://github.com/microsoft/PowerToys/pull/36892
|
||||||
|
using var asyncFlowControl = ExecutionContext.SuppressFlow();
|
||||||
|
|
||||||
Common.InputCallbackThreadID = Thread.CurrentThread.ManagedThreadId;
|
Common.InputCallbackThreadID = Thread.CurrentThread.ManagedThreadId;
|
||||||
while (!Common.InitDone)
|
while (!Common.InitDone)
|
||||||
{
|
{
|
||||||
|
|
|
@ -681,6 +681,10 @@ namespace MouseWithoutBorders.Class
|
||||||
|
|
||||||
private void TCPServerThread(object param)
|
private void TCPServerThread(object param)
|
||||||
{
|
{
|
||||||
|
// SuppressFlow fixes an issue on service mode, where the helper process can't get enough permissions to be started again.
|
||||||
|
// More details can be found on: https://github.com/microsoft/PowerToys/pull/36892
|
||||||
|
using var asyncFlowControl = ExecutionContext.SuppressFlow();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
TcpListener server = param as TcpListener;
|
TcpListener server = param as TcpListener;
|
||||||
|
@ -768,6 +772,10 @@ namespace MouseWithoutBorders.Class
|
||||||
{
|
{
|
||||||
void ServerThread()
|
void ServerThread()
|
||||||
{
|
{
|
||||||
|
// SuppressFlow fixes an issue on service mode, where the helper process can't get enough permissions to be started again.
|
||||||
|
// More details can be found on: https://github.com/microsoft/PowerToys/pull/36892
|
||||||
|
using var asyncFlowControl = ExecutionContext.SuppressFlow();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Receiving packages
|
// Receiving packages
|
||||||
|
@ -876,6 +884,10 @@ namespace MouseWithoutBorders.Class
|
||||||
{
|
{
|
||||||
void ClientThread(object obj)
|
void ClientThread(object obj)
|
||||||
{
|
{
|
||||||
|
// SuppressFlow fixes an issue on service mode, where the helper process can't get enough permissions to be started again.
|
||||||
|
// More details can be found on: https://github.com/microsoft/PowerToys/pull/36892
|
||||||
|
using var asyncFlowControl = ExecutionContext.SuppressFlow();
|
||||||
|
|
||||||
IPHostEntry host;
|
IPHostEntry host;
|
||||||
bool useName2IP = false;
|
bool useName2IP = false;
|
||||||
List<IPAddress> validAddresses = new();
|
List<IPAddress> validAddresses = new();
|
||||||
|
@ -1117,6 +1129,10 @@ namespace MouseWithoutBorders.Class
|
||||||
{
|
{
|
||||||
void NewTcpClient()
|
void NewTcpClient()
|
||||||
{
|
{
|
||||||
|
// SuppressFlow fixes an issue on service mode, where the helper process can't get enough permissions to be started again.
|
||||||
|
// More details can be found on: https://github.com/microsoft/PowerToys/pull/36892
|
||||||
|
using var asyncFlowControl = ExecutionContext.SuppressFlow();
|
||||||
|
|
||||||
TcpClient tcpClient = null;
|
TcpClient tcpClient = null;
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -1549,6 +1565,10 @@ namespace MouseWithoutBorders.Class
|
||||||
|
|
||||||
private static void AcceptConnectionAndSendClipboardData(object param)
|
private static void AcceptConnectionAndSendClipboardData(object param)
|
||||||
{
|
{
|
||||||
|
// SuppressFlow fixes an issue on service mode, where the helper process can't get enough permissions to be started again.
|
||||||
|
// More details can be found on: https://github.com/microsoft/PowerToys/pull/36892
|
||||||
|
using var asyncFlowControl = ExecutionContext.SuppressFlow();
|
||||||
|
|
||||||
TcpListener server = param as TcpListener;
|
TcpListener server = param as TcpListener;
|
||||||
|
|
||||||
do
|
do
|
||||||
|
@ -1590,6 +1610,10 @@ namespace MouseWithoutBorders.Class
|
||||||
{
|
{
|
||||||
new Task(() =>
|
new Task(() =>
|
||||||
{
|
{
|
||||||
|
// SuppressFlow fixes an issue on service mode, where the helper process can't get enough permissions to be started again.
|
||||||
|
// More details can be found on: https://github.com/microsoft/PowerToys/pull/36892
|
||||||
|
using var asyncFlowControl = ExecutionContext.SuppressFlow();
|
||||||
|
|
||||||
System.Threading.Thread thread = Thread.CurrentThread;
|
System.Threading.Thread thread = Thread.CurrentThread;
|
||||||
thread.Name = $"{nameof(SendOrReceiveClipboardData)}.{thread.ManagedThreadId}";
|
thread.Name = $"{nameof(SendOrReceiveClipboardData)}.{thread.ManagedThreadId}";
|
||||||
Thread.UpdateThreads(thread);
|
Thread.UpdateThreads(thread);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче