473,382 Members | 1,431 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Aborting a suspended thread

I'm trying to abort a suspended thread, but I get a ThreadStateException:

An unhandled exception of type 'System.Threading.ThreadStateException'
occurred in mscorlib.dll

Additional information: Thread is suspended; attempting to abort.

I have a number or threads in my program - some running, some suspended. I
hope I don't have to start the thread up again just to abort it??

Nov 21 '05 #1
2 4269
MSDN Help wrote: ;)
If Abort is called on a thread that has not been started, the thread will
abort when Start is called. If Abort is called on a thread that has been
suspended, the thread is resumed and then aborted. If Abort is called on a
thread that is blocked or is sleeping, the thread is interrupted and then
aborted. If, while executing unmanaged code, a thread ignores a
ThreadAbortException, the system re-throws the ThreadAbortException when the
thread begins executing managed code.

"Mark Denardo" wrote:
I'm trying to abort a suspended thread, but I get a ThreadStateException:

An unhandled exception of type 'System.Threading.ThreadStateException'
occurred in mscorlib.dll

Additional information: Thread is suspended; attempting to abort.

I have a number or threads in my program - some running, some suspended. I
hope I don't have to start the thread up again just to abort it??

Nov 21 '05 #2
> If Abort is called on a thread that has been suspended, the thread is
resumed and then aborted.
hmmm, not in my case...
"Rothariger" <Ro********@msn.com> wrote in message
news:02**********************************@microsof t.com... MSDN Help wrote: ;)
If Abort is called on a thread that has not been started, the thread will
abort when Start is called. If Abort is called on a thread that has been
suspended, the thread is resumed and then aborted. If Abort is called on a
thread that is blocked or is sleeping, the thread is interrupted and then
aborted. If, while executing unmanaged code, a thread ignores a
ThreadAbortException, the system re-throws the ThreadAbortException when
the
thread begins executing managed code.

"Mark Denardo" wrote:
I'm trying to abort a suspended thread, but I get a ThreadStateException:

An unhandled exception of type
'System.Threading.ThreadStateException'
occurred in mscorlib.dll

Additional information: Thread is suspended; attempting to abort.

I have a number or threads in my program - some running, some suspended.
I
hope I don't have to start the thread up again just to abort it??

Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Carlos Kirkconnell | last post by:
I'm programming a multi - threaded application using C#. I have two questions regarding to the use of threads 1- I have a Hashtable that will have multiple writters and multiple readers. I used...
4
by: Guido Kraus | last post by:
Hi, I have a VB Windows Forms app that has a single form ('MainForm'). MainForm has a shared (C#: static) class variable that holds a reference to a newly created Thread. This thread does some...
1
by: johnny | last post by:
In a multi-threaded application, say a worker thread makes an asynchronous call and specifies a callback method. But before the callback is executed, the thread is aborted by its creator. What is...
1
by: Amratash | last post by:
I'm receiving the above mentioned error.The problem is: "I suspend one thread.Another thread is resuming the first thread.Then I added following code:Its in simple english if(first thread is not...
1
by: Andreas Müller | last post by:
Hi All, What I want to do, is to reuse a thread after it was supended. However, if the thread was suspended for a while and I reinvoke it using Thread.Resume(), an exception is thrown. If I look...
3
by: jmd.msdn | last post by:
Hello. I want to abort a thread whose thread function contains something like : void threadfunc () { while ( 1 ) { ... some code udpClient.Receive(...); // instance to read network data...
7
by: archana | last post by:
Hi all, I am having application in which i am doing asynchronous call.I am using manualresetevent to wait for asynchronous call to complete. I want to stop asynchronous call after certain...
4
by: Mufasa | last post by:
Is there any way to force a thread to abort and really have it abort? I have a thread that every once in a while gets hung to so I kill it. Problem is I have a thread that every once in a while...
3
by: AdrianDev | last post by:
Hi, I have a thread which I call like this: // Allocate a new thread containing class with the host getInfoThread git = new getInfoThread(host); // Create the thread and call the Go method...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.