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

How to kill a thread

MWK
Hi All,

I suspect in VC++.Net (managed, VS2003)
MyThread.Abort();
is unable to kill the thread.

It was easy in C#.Net
MyThread.Abort();
MyThread = null;

Does anyone know the way to kill a thread?

Thanks and kind regards,
MWK


Nov 17 '05 #1
2 1299
If the code is same (except for syntactic differences of course), what works
in C# should work in MC++ too.

--
Regards,
Nish [VC++ MVP]
http://www.voidnish.com /* MVP tips tricks and essays web site */
http://blog.voidnish.com /* My blog on C++/CLI, MFC, Whidbey, CLR... */
"MWK" <MW*@NoSpam.NG> wrote in message
news:eh**************@TK2MSFTNGP10.phx.gbl...
Hi All,

I suspect in VC++.Net (managed, VS2003)
MyThread.Abort();
is unable to kill the thread.

It was easy in C#.Net
MyThread.Abort();
MyThread = null;

Does anyone know the way to kill a thread?

Thanks and kind regards,
MWK

Nov 17 '05 #2
Are you using the code in the same way? It's generally considered that
Abort() is a bit extreme for most purposes, and some kind of exit condition
is preferred. Like Nishant said, what works in C# should work in equivalent
C++ and it it doesn't, it's probably being used differently. If you could
post some code that replicates the problem, someone'll be able to give you
better advice.

Steve

"MWK" <MW*@NoSpam.NG> wrote in message
news:eh**************@TK2MSFTNGP10.phx.gbl...
Hi All,

I suspect in VC++.Net (managed, VS2003)
MyThread.Abort();
is unable to kill the thread.

It was easy in C#.Net
MyThread.Abort();
MyThread = null;

Does anyone know the way to kill a thread?

Thanks and kind regards,
MWK

Nov 17 '05 #3

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

Similar topics

12
by: Jerry Sievers | last post by:
Greetings Pythonists; I have limited experience with threaded apps and plenty with old style forked heavyweight multi-processing apps. Using Python 2.3.3 on a Redhat 7.x machine. Wondering...
10
by: Jacek Popławski | last post by:
Hello. I am going to write python script which will read python command from socket, run it and return some values back to socket. My problem is, that I need some timeout. I need to say for...
9
by: Brett | last post by:
I'm trying to kill a thread spawned this way: Form1 spawns Class1 via Thread.start() Here's my code to kill the thread: If (t.ThreadState.ToString = "SuspendedRequested, WaitSleepJoin") Or...
2
by: Christopher Carnahan | last post by:
I need to figure out how to terminate a thread while it is blocked trying to create a COM object via interop. In a worker thread, I do something like this: Type t = null; Object...
51
by: Hans | last post by:
Hi all, Is there a way that the program that created and started a thread also stops it. (My usage is a time-out). E.g. thread = threading.Thread(target=Loop.testLoop) thread.start() ...
3
by: Thomas Dybdahl Ahle | last post by:
Hi, I'm writing an application that connects to the internet. Something like this: for res in socket.getaddrinfo(host, port, 0, socket.SOCK_STREAM): af, socktype, proto, canonname, sa = res...
5
by: Teja | last post by:
Hi all, Can any on help me out in killing a thread (i.e deleteing the reources like, stack ,memory etc) which is started with win32process.beginthreadex()??? Rite now, I am suspending the...
18
by: =?Utf-8?B?VGhlU2lsdmVySGFtbWVy?= | last post by:
Because C# has no native SSH class, I am using SharpSSH. Sometimes, for reasons I do not know, a Connect call will totally lock up the thread and never return. I am sure it has something to do...
4
by: Mathieu Prevot | last post by:
Hi, I have a threading.Thread class with a "for i in range(1,50)" loop within. When it runs and I do ^C, I have the error as many as loops. I would like to catch this exception (and if possible...
1
by: =?Utf-8?B?QWxoYW1icmEgRWlkb3MgS2lxdWVuZXQ=?= | last post by:
Hi misters, Is it possible "kill" the thread of Backgroundworker ? In my Dowork event, I have NOT While for do e.Cancel = true, only have a call to external COM. If I want cancel, calling...
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: 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:
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: 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?
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...

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.