🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: _beginthread and _beginthreadNT

#3195
From: Darko Miletic
Date: Wed, 26 Jul 2006 19:34
19 lines
2024 bytes
Danzer wrote:
> If in a program I call _beginthread and/or _beginthreadNT many times,
> will a memory leak result if I do not call CloseHandle for the handle 
> returned by the functions?

You do not call CloseHandle for handles returned from _beginthread. 
Instead you use _endthread. Furthermore this is what says BDS help:

"The _beginthread function creates and starts a new thread. The thread 
starts execution at start_address.
The size of its stack in bytes is stack_size; the stack is allocated by 
the operating system after the stack size is rounded up to the next 
multiple of 4096. The thread is passed arglist as its only parameter; it 
can be NULL, but must be present. The thread function should terminate 
by simply returning; the _endthread. function will be called 
automatically. The _endthread function will automatically close the 
handle, and set the return value of the thread to zero."

So in short answer is no.
Technical Details
Message-ID: <44c7c3b3@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <44c7bef9$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,35b0f98cca5e7340,start
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Wed, 26 Jul 2006 16:34:10 -0300
From: Darko Miletic <darko@vmn.com.ar>
User-Agent: Thunderbird 1.5.0.4 (Windows/20060516)
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: _beginthread and _beginthreadNT
References: <44c7bef9$1@newsgroups.borland.com>
In-Reply-To: <44c7bef9$1@newsgroups.borland.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Antivirus: avast! (VPS 0630-2, 26/07/2006), Outbound message
X-Antivirus-Status: Clean
NNTP-Posting-Host: 200.126.133.133
Message-ID: <44c7c3b3@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1153942451 200.126.133.133 (26 Jul 2006 12:34:11 -0700)
Lines: 20
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail