🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.nativeapi
2 messages
2 total messages Started by Danzer Wed, 26 Jul 2006 19:13
_beginthread and _beginthreadNT
#3196
Author: Danzer
Date: Wed, 26 Jul 2006 19:13
5 lines
1038 bytes
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?

Danzer
Re: _beginthread and _beginthreadNT
#3195
Author: 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.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads