cURL / Mailing Lists / curl-library / Single Mail

curl-library

[ curl-Bugs-927979 ] win32 thread usage

From: SourceForge.net <noreply_at_sourceforge.net>
Date: Thu, 01 Apr 2004 18:07:20 -0800

Bugs item #927979, was opened at 2004-04-02 12:07
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=927979&group_id=976

Category: libcurl
Group: bad behaviour
Status: Open
Resolution: None
Priority: 5
Submitted By: Nathan OSullivan (nats23)
Assigned to: Daniel Stenberg (bagder)
Summary: win32 thread usage

Initial Comment:
libcurl 7.11.1

Two Win32 threading issues I noticed, both in
lib/hostip.c

In init_gethostbyname_thread() --

  td->thread_hnd = CreateThread(NULL, 0,
gethostbyname_thread, conn, 0, &td->thread_id);

The windows documentation says that using
CreateThread() can cause memory leaks if the created
thread uses the C run-time. I&#039;m not sure if the use here
of CreateThread is causing any problems, but to be safe
you should use _beginthreadex() (exact same
paramaters) instead of CreateThread().

Second real problem, CloseHandle() is never called to
release the thread handle. Until this is done, the
internal windows thread object is not released.

This can be done in Curl_wait_for_resolv() straight after
the TRACE line, eg

CloseHandle(td->thread_hnd);

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=927979&group_id=976
Received on 2004-04-02