Home > Net >  ASP.NET how to manage (pause, hangs, end) other page on the thread?
ASP.NET how to manage (pause, hangs, end) other page on the thread?

Time:09-29

When I was in the aspx page 1 in the following way opened a thread myThread1, after close the page, it will continue to run (w3wp process is not over yet, it will continue to run),

 
ParameterizedThreadStart ParStart=new ParameterizedThreadStart DoSomething ();
Thread myThread=new Thread (ParStart);
MyThread. Name="myThread1";
MyThread. Start ();


The state of the process of how to get to the other page myThread1, and can control it (pause, hang, end)?

CodePudding user response:

In global. Aspx application start defined inside the thread myThread
Create a thread in A.a the SPX and start
B.a in SPX control it, such as
 
If (myThread!=null)
{
MyThread. Abort ();//forced end
}

CodePudding user response:

reference 1/f, autumn red fruit reply:
in global. Aspx application start defined inside the thread myThread
Create a thread in A.a the SPX and start
B.a in SPX control it, such as
 
If (myThread!=null)
{
MyThread. Abort ();//forced end
}



On the global file is not convenient, if multiple pages could create a thread, management is not so convenient,
Can you list all threads in the w3wp process, make a list, manual decided to suspend or end,

Reference:
https://blog.csdn.net/wwwsq/article/details/76537788

CodePudding user response:

Check the method to control the process:

[the.net] Suspend Process Suspend batch execution
https://dotblogs.com.tw/stanley14/2016/01/19/145355

.net - Suspend Process in c # - Stack Overflow
https://stackoverflow.com/questions/71257/suspend-process-in-c-sharp

The thread is still in research

CodePudding user response:

reference 1/f, autumn red fruit reply:
in global. Aspx application start defined inside the thread myThread
Create a thread in A.a the SPX and start
B.a in SPX control it, such as
 
If (myThread!=null)
{
MyThread. Abort ();//forced end
}



Multithreading - time/aborting a specific thread using it 's ID in c # - Stack Overflow
https://stackoverflow.com/questions/28295619/killing-aborting-a-specific-thread-using-its-id-in-c-sharp

Abort () it's too dangerous, it may cause interruption of the entire process, with a hang, reference this solved,