Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MWB] Fix helper process termination issue in service mode #36892

Merged
merged 6 commits into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/modules/MouseWithoutBorders/App/Class/Common.Clipboard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,8 @@ private static void SendClipboardDataUsingTCP(byte[] bytes, bool image)

new Task(() =>
{
using var asyncFlowControl = ExecutionContext.SuppressFlow();

System.Threading.Thread thread = Thread.CurrentThread;
thread.Name = $"{nameof(SendClipboardDataUsingTCP)}.{thread.ManagedThreadId}";
Thread.UpdateThreads(thread);
Expand Down Expand Up @@ -386,6 +388,8 @@ internal static void GetRemoteClipboard(string postAction)

new Task(() =>
{
using var asyncFlowControl = ExecutionContext.SuppressFlow();

System.Threading.Thread thread = Thread.CurrentThread;
thread.Name = $"{nameof(ConnectAndGetData)}.{thread.ManagedThreadId}";
Thread.UpdateThreads(thread);
Expand Down
2 changes: 2 additions & 0 deletions src/modules/MouseWithoutBorders/App/Class/Common.Helper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ private static void WatchDogThread()

private static void HelperThread()
{
using var asyncFlowControl = System.Threading.ExecutionContext.SuppressFlow();

try
{
while (true)
Expand Down
2 changes: 2 additions & 0 deletions src/modules/MouseWithoutBorders/App/Class/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,8 @@ internal static void StartInputCallbackThread()

private static void InputCallbackThread()
{
using var asyncFlowControl = ExecutionContext.SuppressFlow();

Common.InputCallbackThreadID = Thread.CurrentThread.ManagedThreadId;
while (!Common.InitDone)
{
Expand Down
12 changes: 12 additions & 0 deletions src/modules/MouseWithoutBorders/App/Class/SocketStuff.cs
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,8 @@ internal int TcpSend(TcpSk tcp, DATA data)

private void TCPServerThread(object param)
{
using var asyncFlowControl = ExecutionContext.SuppressFlow();

try
{
TcpListener server = param as TcpListener;
Expand Down Expand Up @@ -768,6 +770,8 @@ private void StartNewTcpServer(TcpSk tcp, string machineName)
{
void ServerThread()
{
using var asyncFlowControl = ExecutionContext.SuppressFlow();

try
{
// Receiving packages
Expand Down Expand Up @@ -876,6 +880,8 @@ internal void StartNewTcpClient(string machineName)
{
void ClientThread(object obj)
{
using var asyncFlowControl = ExecutionContext.SuppressFlow();

IPHostEntry host;
bool useName2IP = false;
List<IPAddress> validAddresses = new();
Expand Down Expand Up @@ -1117,6 +1123,8 @@ private void StartNewTcpClientThread(string machineName, IPAddress ip)
{
void NewTcpClient()
{
using var asyncFlowControl = ExecutionContext.SuppressFlow();

TcpClient tcpClient = null;

try
Expand Down Expand Up @@ -1549,6 +1557,8 @@ private void MainTCPRoutine(TcpSk tcp, string machineName, bool isClient)

private static void AcceptConnectionAndSendClipboardData(object param)
{
using var asyncFlowControl = ExecutionContext.SuppressFlow();

TcpListener server = param as TcpListener;

do
Expand Down Expand Up @@ -1590,6 +1600,8 @@ private static void AcceptConnectionAndSendClipboardData(object param)
{
new Task(() =>
{
using var asyncFlowControl = ExecutionContext.SuppressFlow();

System.Threading.Thread thread = Thread.CurrentThread;
thread.Name = $"{nameof(SendOrReceiveClipboardData)}.{thread.ManagedThreadId}";
Thread.UpdateThreads(thread);
Expand Down
Loading