public inbox for pthreads-win32@sourceware.org
 help / color / mirror / Atom feed
* FW: HANDLE leak
@ 1999-10-12  9:04 Geoff Stevens
  0 siblings, 0 replies; only message in thread
From: Geoff Stevens @ 1999-10-12  9:04 UTC (permalink / raw)
  To: 'pthreads-win32@sourceware.cygnus.com'

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1902 bytes --]

Title: FW: HANDLE leak





Steve,


I think you should either create your threads detached (set PTHREAD_CREATE_DETACHED in the attributes) or do a pthread_join for each of them in main().

At the moment the threads you create are waiting for a join after pthread_exit, and their Win32 threads (and thus their handles) cannot be released.

I'm using detached threads with the same levels of the library and NT and see no increase in handle usage after all my threads have terminated.

Best,
Geoff Stevens   


-----Original Message-----
From:   Steve Croall [SMTP:SCroall@staffware.com]
Sent:   12 October 1999 16:24
To:     geoff.stevens@macro4.com
Subject:        HANDLE leak


The following small program shows the HANDLE count in "Performance Monitor",
for the executable when running, increasing at an alarming rate.  Is this
normal or am I not doing something to clear-up?  I am using the 1999-09-17
snap-shot on Windows NT 4, service pack 4.


#include <stdio.h>
#include <stdlib.h>
#include <conio.h>


#include "pthread.h"


void *thrd_func (void *i)
{
        Sleep (500);


        pthread_exit ((void *) 1);
}


int main (int argc, char **argv)
{
        int             i = 0;
        pthread_t       t_id;


        while (!_kbhit ())
        {
                Sleep (1000);
                pthread_create (&t_id, NULL, (void *) thrd_func, NULL);
        }


        Sleep (1000);
}



Regards,


        Steve Croall ( SCroall@staffware.com )



Chicago law prohibits eating in a place that is on fire.




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1999-10-12  9:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-10-12  9:04 FW: HANDLE leak Geoff Stevens

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).