🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #19055

Re: thread and variables nb. threads are special

#19055
From: Greg Dickson
Date: Wed, 18 Mar 1998 00:00
45 lines
1957 bytes
James I thought youd be interested in this one
its a quote from Bruce Eckels Thinking in Java

"An ordinary object would be fair game for garbage collection, but not
a Thread. Each Thread �registers� itself so there is actually a
reference to it someplace and the garbage collector can�t clean it
up."

So basicallit looks like you can just call it and forget it
Pretty cool hey

Greg

James Rudnicki wrote in message <6elcmn$pqb6@forums.borland.com>...
>
>Greg Dickson wrote in message <6ej7rq$nmb1@forums.borland.com>...
>>if I start a thread from a method with say
>>
>>private  void doCommand (String doThis) {
>>
>>RunCommand tc = new RunCommand(doThis);
>>
>>What happens if the method is called several times
>
>
>Well, tc gets the new reference to the object each time the method is
>called, but I would worry about the garbage collector.  When you
create the
>new instance, the reference to the old instance becomes unused.  What
has a
>reference to the old and still executing thread? Nothing, so the
garbage
>collector might try to clean up thereby ruining the data members.
>
>You may get lucky because an event listener could have a reference
and keep
>the instance alive, but...
>
>Maybe keep all the references on a Stack or Vector.
>
>bye
>
>
>
Technical Details
Message-ID: <6enifo$ru06@forums.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <6ej7rq$nmb1@forums.borland.com> <6elcmn$pqb6@forums.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: f74b3,ddaf1f759f6f1855
X-Google-Attributes: gidf74b3,public
From: "Greg Dickson" <witchy@netserv.net.au>
Subject: Re: thread and variables nb. threads are special
Date: 1998/03/18
Message-ID: <6enifo$ru06@forums.borland.com>
X-Deja-AN: 335132098
Content-Transfer-Encoding: 8bit
References: <6ej7rq$nmb1@forums.borland.com> <6elcmn$pqb6@forums.borland.com>
Content-Type: text/plain; charset="iso-8859-1"
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4
Organization: Another Netscape Collabra Server User
Mime-Version: 1.0
Newsgroups: borland.public.jbuilder.java.language