Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Mar 20th, 2006, 2:49 AM   #1
NoSnipeLimit
Newbie
 
Join Date: Mar 2006
Posts: 1
Rep Power: 0 NoSnipeLimit is on a distinguished road
Thread Handles?

Hello,

I have an application that creates a thread to execute a ping function. The concept i think is pretty basic. Below is how I call the thread.

with F_Main do
begin
p_MyPingThread := Ping_Thread.m_Create(True,
ThreadSOBJ,
Description,
h_DriverWindowHandle,
h_DriverFormHandle);
p_MyPingThread.FreeOnTerminate := True;
p_MyPingThread.Resume;
end;

So i create the thread and free it. When i look at my task manager i see the thread being created, then freed. However, the total handles keep increasing. Anyone that could explain to me why this would happen?

Kind Regards
Anton
NoSnipeLimit is offline   Reply With Quote
Old Mar 20th, 2006, 6:25 AM   #2
grumpy
Programming Guru
 
grumpy's Avatar
 
Join Date: Jun 2005
Location: Adelaide, South Australia
Posts: 1,203
Rep Power: 5 grumpy is on a distinguished road
The act of terminating a thread does not close it's handle.

According to the win32 help file ....
Quote:
The thread object remains in the system until the thread has terminated and all handles to it have been closed through a call to CloseHandle.
which means you need to pass the thread handle to the win32 API function CloseHandle().
grumpy is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 8:21 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC