cURL / Mailing Lists / curl-library / Single Mail

curl-library

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

From: David Byron <DByron_at_everdreamcorp.com>
Date: Fri, 2 Apr 2004 08:50:15 -0800

On Fri, 2 Apr 2004, Gisle Vanem wrote:

> _endthreadex() is rather confusing. It cannot AFAICS be
> called from the parent-thread since it doesn't take a
> thread-handle (as TerminateThread does).
>
> Hopefully the attached patch fixes the leak.

It looks OK to me. I handle stuff like this by:

- always using _beginthreadex
- never calling TerminateThread, _endthread, or _endthreadex. If I need a
thread to end, I'll typically set an event that it's waiting on, or maybe
use an int as a flag and poll it.

-DB
Received on 2004-04-02