cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: [ curl-Bugs-927979 ] win32 thread usage

From: Nathan O'Sullivan <nathan_at_mammoth.com.au>
Date: Fri, 2 Apr 2004 17:56:48 +1000

Here's the relevant text on MSDN

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/createthread.asp

Specifically, "A thread that uses functions from the static C run-time
libraries should use the _beginthread and _endthread C run-time functions
for thread management rather than CreateThread and ExitThread. Failure to do
so results in small memory leaks when ExitThread is called. Note that this
is not a problem with the C run-time in a DLL."

So it depends how you link the run-time in. However, there's no negative
(that I'm aware of) to calling _beginthreadex()

Re CloseHandle()

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt__beginthread.2c_._beginthreadex.asp

"endthread automatically closes the thread handle (whereas _endthreadex does
not). Therefore, when using _beginthread and _endthread, do not explicitly
close the thread handle by calling the Win32 CloseHandle API." -- Which
kind of covers the inverse.

The CreateThread documentation is more specific

"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."

Regards
Nathan

----- Original Message -----
From: "Daniel Stenberg" <daniel-curl_at_haxx.se>
To: <curl-library_at_cool.haxx.se>
Sent: Friday, April 02, 2004 4:00 PM
Subject: Re: [ curl-Bugs-927979 ] win32 thread usage

> On Thu, 1 Apr 2004, SourceForge.net wrote:
>
> >
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=927979&group_id=976
>
> I'm hoping one of you win32-skilled people can read and comment this bug
> report!
>
> --
> Daniel Stenberg -- http://curl.haxx.se -- http://daniel.haxx.se
> Dedicated custom curl help for hire: http://haxx.se/curl.html
>
Received on 2004-04-02