473,804 Members | 3,126 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Need help regarding threading

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 entries in my temprary file.
But when i called abort on thread it is not aborting that thread.
After calling aborting still entries are getting inserted into
temporary files.
That means still recursive function is getting executed.
Can some one tell me why this is happening even after calling abort on
thread.
Is there any alternative for aborting thread.
Please help me as this is very very important for me.

Thanks in advance.

Jul 22 '05 #1
3 1379

The thing that you have to be carefull is that the threaad you are creating
is not creating sub threads inside your recusrisv function other wise you
will never give up.
Try to log the thread ID or name when you start it for the first time then
retrive the current thread name when recusrsive is called, just to be sure
that you are not creating threads of threads.

Post also your sample code
"tr************ **@yahoo.com" wrote:
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 entries in my temprary file.
But when i called abort on thread it is not aborting that thread.
After calling aborting still entries are getting inserted into
temporary files.
That means still recursive function is getting executed.
Can some one tell me why this is happening even after calling abort on
thread.
Is there any alternative for aborting thread.
Please help me as this is very very important for me.

Thanks in advance.

Jul 22 '05 #2
<tr************ **@yahoo.com> wrote:
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 entries in my temprary file.
But when i called abort on thread it is not aborting that thread.
After calling aborting still entries are getting inserted into
temporary files.
That means still recursive function is getting executed.
Can some one tell me why this is happening even after calling abort on
thread.
Is there any alternative for aborting thread.
Please help me as this is very very important for me.


Could you post a short but complete program which demonstrates the
problem?

See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.

You should pretty much never call Thread.Abort. See
http://www.pobox.com/~skeet/csharp/t...shutdown.shtml and
http://www.pobox.com/~skeet/csharp/threads/abort.shtml

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

Hi there,

Threads are a bit tricky to work with. Follow other suggestions here (sub
threads). If you cannot figure it out, you can always use a global variable
and have the loop (or whatever you are using for this matter) check this
variable for a particular value that will signal abort.

Good luck!

--
Juan Romero
-----------------------------------------
The successful person has the habit of doing the things failures don't like
to do.
E.M. Gray
"tr************ **@yahoo.com" wrote:
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 entries in my temprary file.
But when i called abort on thread it is not aborting that thread.
After calling aborting still entries are getting inserted into
temporary files.
That means still recursive function is getting executed.
Can some one tell me why this is happening even after calling abort on
thread.
Is there any alternative for aborting thread.
Please help me as this is very very important for me.

Thanks in advance.

Jul 22 '05 #4

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

Similar topics

6
2245
by: akash shetty | last post by:
hi, im developing a code which requires searching a large database(bioological) for certain patterns.the size of the file is 3.5GB . the search pattern is a ten letter string.the database consists of paragraphs. the code ive developed searches the data paragraphwise. (using xreadlines). but this takes an awful amt of time.(abt 7 mins) is there anyway to speed this up.
8
1658
by: Bf | last post by:
I was creating test projects using c# and was surprised that there seems to be only a form based windows applications available. Is it safe to assume that classic window applications that utilize a parent window with child windows can only be done in c++ and mfc and there's nothing else in .net that is meant to be used like that? It seems to be that c# should be used for either form based windows apps, console apps, and web apps (also...
4
1325
by: trialproduct2004 | last post by:
Hi all i am having application in C#. here what i want it to update one datagrid depending on particular value. I want to start minimum of 5 threads at a time and all these threads are updating datagrid in their thread proceudre. What i want is whenever 5 threads are running as soon as one thread finish its execution i want to asssing new thread proceudre to that thread. Can some one tell me how to do it?
2
7911
by: Chandrakant Shinde | last post by:
Hi there, I want to copy a Image to the clipboard. When i try to do so following exception occurs : "The current thread must set to Single Thread Apartment (STA) mode before OLE calls can be made. Ensure that your Main function has STAThreadAttribute marked on it" Following are the points i want to say : 1. Which is the main method in windows forms ? When i tried to assign <STAThread()> attribute to Public sub New () it gave me...
3
236
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 entries in my temprary file. But when i called abort on thread it is not aborting that thread. After calling aborting still entries are getting inserted into temporary files. That means still recursive function is getting executed. Can some one...
2
4892
by: NiponW | last post by:
Hi, I have SQL SERVER 2000 SP4 Enterprise , Windows 2003 Enterprise on Xeon 4 Processors (now with multi-threading CPU) and I have questions which seem weirds to me (used to have the same config without Multi-Threading) as following: 1. SQL Server see 8 CPUs. Is this because of multi-threading CPUs ? 2. when use SP_WHO2 ACTIVE ,
10
1696
by: HK | last post by:
With VB.NET 2005, and a Windows Form, running on a dual CPU box, I need to take a recordset (e.g. 100,000 records) and spawn a thread to handle an internet XML transaction routine for each of the records. This is a nice use of threading because those internet requests are going against 3rd party servers that often have 1 second latency problems and so handling them with multiple threads is the fastest way to get through all the records in...
4
1401
by: archana | last post by:
Hi all, I am having one confusion regarding invoking web method of web service asychronously through windows applicaiton. What i am doing is i am having one long runing web method whose one way attribute is set as i don't want any return value from that method. What i observered is when my window application start calling web method asynchronoysly
3
1708
by: archana | last post by:
Hi all, I have one confusion regarding threading in windows service which is developed in c#. What i am doing is on 'onstart' event i am starting one thread. In thread procedure i am processing some URL's asynchronously. Say in thread procedure for validating url through webrequest i am
0
9705
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9575
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10564
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10320
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9134
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7609
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6846
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5513
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5645
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.