[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: pthread resources



i've noted that when you exit the main() thread all the others
terminate. i think there should be a solution, but because i
never needed it, i never searched for it. but you tickled my
curiosity... i'll investigate...

ciao,
federico 

Scavenging the mail folder uncovered Allan M. Wind's letter:
> Hi,
> 
> Anyone know of good pthred references?  Read everything at
> http://pauillac.inria.fr/~xleroy/linuxthreads/ and references
> from there.  For instance, I am trying to figure out if this is
> correct:
> 
> main() {
> 	pthread_t p, p2;
> 	char *c;
> 	char c2[] = "something";
> 
> 	c = strdup("some data");
> 	pthread_create(&p, 0, f, c);
> 	pthread_create(&p2, 0, f2, c2);
> 
> 	exit(0);
> 	/*
> 	  what happens with p and p2 here - will they or c2 be out of
> 	  scope?  Do I need a join before the exit(0)
> 	*/
> }
> 
> 
> void *f(void *v) {
> 	free(v);
> 	// let the thread sleep for a while
> }
> 
> void *f2(void *v) {
> 	// let the thread sleep for a while
> }
> 
> 
> /Allan
> -- 
> Allan M. Wind			Finger: wind@digit-safe.dyndns.org (GPG/PGP)
> P.O. Box 2022			Email: wind@freewwweb.com
> Woburn, MA 01888-0022		ICQ: 44214251
> USA				Phone: 781.279.4513
> 
> 
> -- 
> To UNSUBSCRIBE, email to debian-devel-request@lists.debian.org
> with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
> 

-- 
Federico Di Gregorio
MIXAD LIVE System Programmer                           fog@mixadlive.com
Debian GNU/Linux Developer & Italian Press Contact        fog@debian.org
  99.99999999999999999999% still isn't 100% but sometimes suffice. -- Me


Reply to: