473,382 Members | 1,329 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.

Problem with Thread.Abort()

hi,

i coded an application in which i can move a slider to define a radius
and it computes a gaussian blur in a thread.

because the Scroll event of the slider is often raised, i use one thread
(declared in the form's class) that i abort when it is already existing
and running.

this works well but sometimes i've got this error (translated from
french) : The thread is suspended ; trying to abort.

it comes at the next line of myThread.Abort() and if i put it in a
try/catch it freezes instead of showing this error.

what's the problem ?
Nov 17 '05 #1
1 2033
Ennixo <en****@free.fr> wrote:
i coded an application in which i can move a slider to define a radius
and it computes a gaussian blur in a thread.

because the Scroll event of the slider is often raised, i use one thread
(declared in the form's class) that i abort when it is already existing
and running.
Ouch, not a nice idea. Thread.Abort is not a good idea, IMO. You should
tell your thread to stop running in a more controlled manner.

See
http://www.pobox.com/~skeet/csharp/threads/abort.shtml
this works well but sometimes i've got this error (translated from
french) : The thread is suspended ; trying to abort.

it comes at the next line of myThread.Abort() and if i put it in a
try/catch it freezes instead of showing this error.

what's the problem ?


Are you doing any UI work in the worker thread? If so, that's a bad
idea too:
http://www.pobox.com/~skeet/csharp/t...winforms.shtml

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 17 '05 #2

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

Similar topics

6
by: trialproduct2004 | last post by:
Hi all I am having problem at a time of handling threading. I am having application containing thread. In thread procedure i ma using recursive function. This recursive function is adding some...
3
by: bilosta | last post by:
Hello to everybody I'm new in win apllications and C#. I have a problem with Threading. Here is my problem: I have a form with button named: BupisiStudente, when I click on it a call next...
6
by: mehdi | last post by:
Hi folks, You know, the Thread class has got a method named Abort which according to the msdn: "Raises a ThreadAbortException in the thread on which it is invoked, to begin the process of...
4
by: raghudr | last post by:
Hi all, I am implemeting a splash screen in C# I got a useful link from here :- http://www.codersource.net/csharp_splash_screen.aspx //Logic when to display a splash screen is:- Splash...
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
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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.