🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #5619

TThread & CloseHandle

#5619
From: Tassilo J. Klein
Date: Thu, 04 Aug 2005 15:53
17 lines
1728 bytes
Hi there,

I have a problem with a TThread and CloseHandle. I programmed an 
application with a thread which is responsible for downloading data in 
arbitrary time intervals from a device connected via a serial connector.

The serial port is opened with hCom=CreateFile(....) and closed with 
CloseHandle(hCom). Everything works fine....but when for instance the 
device is removed while the thread is trying to download data 
'CloseHandle(hCom)' will be called in order to free the handle. 
Invocation of CloseHandle function out of any reason then calls the 
destructor of the calling TThread ~DownloadThread() although CloseHandle 
is encapsulated by try/catch blocks. Does anybody have an idea? How can 
I prevent that?

Hope somebody has some hints - thanks in advance,
  Tassilo
Technical Details
Message-ID: <dctdlr$6gr$02$1@news.t-online.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsmm00.sul.t-online.de!t-online.de!news.t-online.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,185dcaeb91f025d5,start
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsmm00.sul.t-online.de!t-online.de!news.t-online.com!not-for-mail
From: "Tassilo J. Klein" <nospamTJKlein@web.de>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: TThread & CloseHandle
Date: Thu, 04 Aug 2005 17:53:43 +0200
Organization: T-Online
Lines: 17
Message-ID: <dctdlr$6gr$02$1@news.t-online.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: news.t-online.com 1123170812 02 6683 IMOvJpFlNHu3mey 050804 15:53:32
X-Complaints-To: usenet-abuse@t-online.de
X-ID: TDgiMaZVYeVDNqk5t2ejag+P5uFTbH571mH+oulgC4Waz6bBybTGZB
User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)
X-Accept-Language: en-us, en