Return-Path: Delivered-To: apmail-apr-dev-archive@apr.apache.org Received: (qmail 60043 invoked by uid 500); 25 Nov 2002 04:37:41 -0000 Mailing-List: contact dev-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Delivered-To: mailing list dev@apr.apache.org Received: (qmail 59999 invoked from network); 25 Nov 2002 04:37:40 -0000 Message-Id: <5.1.0.14.2.20021124214455.03cec008@pop3.rowe-clan.net> X-Sender: admin%rowe-clan.net@pop3.rowe-clan.net X-Mailer: QUALCOMM Windows Eudora Version 5.1 Date: Sun, 24 Nov 2002 22:32:59 -0600 To: Marcel.Mann@dbaudio.com From: "William A. Rowe, Jr." Subject: Re: bug in apr_os_thread_current ? Cc: dev@apr.apache.org In-Reply-To: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-OriginalArrivalTime: 25 Nov 2002 04:37:38.0296 (UTC) FILETIME=[6200BF80:01C2943C] X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N At 10:34 AM 11/21/2002, Marcel.Mann@dbaudio.com wrote: >Hi, > >as documented, apr_os_thread_current() returns the id for the current thread. >The WIN32 version calls GetCurrentThread(). GetCurrentThread returns a pseudo handle for the current thread, not the id. >GetCurrentThreadId() returns the id. Ok, that's icky and sticky and full of bleck. The problem we have is that apr_os_thread_current() need to return a HANDLE. However --- if we return a real handle, it's up to the caller to close it. We don't have so much as a pool context to know when to clean it up ourselves. OTOH, apr_os_thread_get() returns the real HANDLE that the user damned well better not close, since we use it internally within APR. The best answer is to return the handle we are using internally, I'm thinking along the lines of dummy_worker() using TlsSetValue() to cache our 'internal' handle we use for the lifetime of the thread. Since nobody 'aught' to be closing that handle, it should be appropriate to return it. TlsGetValue() can retrieve such data on a per-thread basis. I'm tempted to simply cache the apr_thread_t* so we really can get back at any data we need later. Anyone have other thoughts? Bill