myITforum.com Community Forum myITforum.com Community Forum

Home  Forums  Blogs  Live Support chat  Search Articles  Wiki  FAQ  Email Lists  Register  Login  My Profile  Inbox  Address Book  My Subscription  My Forums 

Photo Gallery  Member List  Search  Calendars  FAQ  Ticket List  Log Out

All Forums RSS Feed Subscription:


  


ThreadPool Threads

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
  Printable Version
All Forums >> [Scripting Technologies] >> VB Script >> ThreadPool Threads Page: [1]
Login
Message << Older Topic   Newer Topic >>
ThreadPool Threads - 8/12/2008 10:34:48 AM   
phoenixwithashes

 

Posts: 35
Score: 2
Joined: 10/1/2007
Status: offline
Hi Guys,

I need a way to be able to track all the threads that i launch. Cause one of my program's requirements is to kill one or all threads based on the option selected.

Enumerating all threads from OS does not help because the thread ID is different. Is there a way to manage threads launched by a program by just thread(adressof sub) or threadpool(addressof sub) . I need to be able to track and queue them and selectively kill one or all based on the option.

With one thread its easy cause all you do is threadname.abort?(), but with multiple all have the same name but different IDs.

I'm a beginner at this and i'm using .net and VB


_____________________________

SHASHANK
Post #: 1
RE: ThreadPool Threads - 8/13/2008 3:26:22 PM   
akaplan


Posts: 180
Score: 21
Joined: 4/22/2003
From: North Carolina
Status: offline
You can keep track of them with the process ID.  The best way to do this is launching using WMI Win32_Process.  You can get the PID on launch of the process, and also use WMI to kill processes.  See, ex: http://www.microsoft.com/technet/scriptcenter/resources/qanda/jul05/hey0701.mspx


(in reply to phoenixwithashes)
Post #: 2
RE: ThreadPool Threads - 8/14/2008 6:24:02 AM   
phoenixwithashes

 

Posts: 35
Score: 2
Joined: 10/1/2007
Status: offline
Monitoring the process can't work for me in this case because launching a thread does not launch a seperate process, the main process remains the same and threads are launched with Background="true". Anyway, to track threads launched from inside a program individually and kill them?
Thanks,
Shak

(in reply to akaplan)
Post #: 3
RE: ThreadPool Threads - 8/22/2008 1:27:56 PM   
mseely

 

Posts: 42
Score: 1
Joined: 5/4/2008
Status: offline
For threads, the WMI class would be Win32_Thread ....  (as long as you know the ProcessID and ThreadHandle)

Can also take a look at
Multithreaded Programming with Visual Basic .NEThttp://msdn.microsoft.com/en-us/library/aa289496(VS.71).aspx

and Check the 'Canceling tasks' section.







_____________________________

Mark

(in reply to phoenixwithashes)
Post #: 4
Page:   [1]
All Forums >> [Scripting Technologies] >> VB Script >> ThreadPool Threads Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts



  
Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI

0.297