473,388 Members | 1,355 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,388 software developers and data experts.

How to get access to the thread executing an asynchronous call?

Hi! Does anybody know how to abort a long-running asynchronous call from
the calling thread?
To do this, one needs a reference to the thread executing the call and
there seems to be no easy way to get this reference from the calling thread.

You can do the following but I don't like that much:

....
// calling thread
Thread asyncCallThread;
AsyncCallDlgt.BeginInvoke(ref asyncCallThread, AsyncCallDlgt);
while(asyncCallThread == null){};
....
asyncCallThread.Abort();

....
// called method
public void AsyncCall(ref asyncCallThread)
{
asyncCallThread = Thread.CurrentThread;
...
}

Anyway, is it safe to abort the async call thread?

Any ideas?

Jul 21 '05 #1
0 1441

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

Similar topics

4
by: Coot | last post by:
I've been running many tests of the Asynchronous Delegate technique and I find that although BeginInvoke() does queue the method delegate onto a worker thread, it always does so on the _same_...
18
by: Urs Vogel | last post by:
Hi I wrote an application server (a remoting sinlgeton), where processes must be stopped in very rare cases, done thru a Thread.Abort(). Occasionally, and only after a Thread.Abort(), this...
6
by: Anders Eriksson | last post by:
Hello! I have a form from which I start an thread running in the background and I want to have an event when the thread is done/ends. I start the thread like this: private Thread prT; // this...
0
by: Max Samookha | last post by:
Hi! Does anybody know how to abort a long-running asynchronous call from the calling thread? To do this, one needs a reference to the thread executing the call and there seems to be no easy way to...
3
by: developer | last post by:
Hi All, I am lil confused with different ways of asynchronous data access. My understanding is that, asynchronous data access frees up a thread instead of engaging it while a stored proc is...
6
by: k.mellor | last post by:
Hi, I hope someone can help. I have written a simple form to demonstrate my problem/question. The code follows. The form starts a thread, which using delegates updates a label (Every second...
7
by: Sin Jeong-hun | last post by:
Hi. I'm writing a Client/Multi-threaded Server program on Windows Vista. It worked fine on Windows Vista, but when the server ran on Windows XP, I/O operation has been aborted because of either...
4
by: active | last post by:
I'm reading about Threads but there is so much to understand I don't know where to spend my time. I want a worker thread to populate a list box. I'd like: The main thread to be able to...
4
by: Simon | last post by:
Hi All, I'm currently developping something where I need to use threads. Here's the basic scenario. I have a WebService requests which need to launch a few threads and wait for them to complete...
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
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
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,...
0
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,...
0
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...

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.