If a thread is running a function func1
that calls another function func2
inside it...
Then I called thread.Abort()
Will this stop func1
only
OR func1
and func2
and all the functions func1
has called??
Thanks
Edit: Here are more detail:
func1
is called in a new thread, it continuously calls func2
on regular basis...func2
begin doing some work only if some array is not null.. it finishes it and return
When supervisor wants to save data, it aborts Thread of func1
- and then makes array null, saves data, then fill in the array with new one.. and starts Thread with func1
again..
Sometimes exception is raised because array is null in func2
.. so func1 abort did not affect func2
C programming language is a machine-independent programming language that is mainly used to create many types of applications and operating systems such as Windows, and other complicated programs such as the Oracle database, Git, Python interpreter, and games and is considered a programming foundation in the process of ...
What is C? C is a general-purpose programming language created by Dennis Ritchie at the Bell Laboratories in 1972. It is a very popular language, despite being old. C is strongly associated with UNIX, as it was developed to write the UNIX operating system.
In the real sense it has no meaning or full form. It was developed by Dennis Ritchie and Ken Thompson at AT&T bell Lab. First, they used to call it as B language then later they made some improvement into it and renamed it as C and its superscript as C++ which was invented by Dr.
Compared to other languages—like Java, PHP, or C#—C is a relatively simple language to learn for anyone just starting to learn computer programming because of its limited number of keywords.
Thread.Abort
is not guaranteed to stop the thread and you should avoid using it if possible.
Calling this method usually terminates the thread.
Emphasis mine.
What it does is raise a ThreadAbortException
in the target thread. If you catch this exception, the code will continue executing until it reaches the end of the catch block, at which point the exception is automatically rethrown. If you don't catch it, it is similar to a normal exception - it propagates up the call stack.
Assuming you don't catch the exception, all the code running in that thread will stop running. Other threads that were started from that thread will not be affected.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With