This is the mail archive of the mailing list for the pthreas-win32 project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]


You should call the routine pthread_detach() or set the
PTHREAD_CREATE_DETACHED attribute.  If you call pthread_join() it will block
your program.  The only disadvantage to detached threads is that you can no
longer call pthread_join().  However, if you never need to call this
function then there is no disadvantage.
Aurelio Medina
Bank of America, Distributed Systems Management
Voice:	(312) 234-2105
Fax:	(312) 453-2105 <>

	-----Original Message-----
	From:	Steve Croall []
	Sent:	Tuesday, October 12, 1999 11:05 AM
	To:	'Geoff Stevens'; ''
	Subject:	RE: HANDLE leak

	Thanks.  Are there any disadvantages to running the threads
detached?  Is
	there any reason why this is not the default behaviour?  I wouldn't
	surprised if that was just the way it was :-)

	-----Original Message-----
	From: Geoff Stevens []
	Sent: 12 October 1999 17:04
	To: ''
	Subject: FW: HANDLE leak


	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

	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

	Geoff Stevens   

	-----Original Message----- 
	From:   Steve Croall [] 
	Sent:   12 October 1999 16:24 
	Subject:        HANDLE leak 

	The following small program shows the HANDLE count in "Performance

	for the executable when running, increasing at an alarming rate.  Is
	normal or am I not doing something to clear-up?  I am using the
	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,

	        Sleep (1000); 


	        Steve Croall ( ) 

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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]