🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Stopping threads...

#23
From: JRadecki
Date: Mon, 14 Sep 1998 00:00
35 lines
2084 bytes
Upload Thread class.  I can't understand exactly what your saying...
Why is the TH.stop in the run().  How does that work ?  How is stop() every
getting called ?  Are you
throwing the exception to break the
try{while(true)}catch{InterruptedException}.

Regards
JRadecki


Vladimir Olenin wrote in message <35FC60E9.73D13B3B@collegemail.com>...
>Actually, evrth works, but why it work in that way, i don't understand.
>
>So, i have a class TH that extends Thread. Method run() is not
>synchronized. When i'm trying to stop this thread (TH.stop()) i'm
>ranning into following problem:
>
>- TH.stop() is the "last" line of method run(). All resources are closed
>before calling this function. ---- Evrth is fine and works.
>
>- TH.stop() is in the middle of method run() or a function that calls
>it. Program hangs.
>
>Talking about resources, i have in/out streams and socket. All of them
>certainly must be closed. But it hangs only on that line, no matter
>where it exactly stands. (eg, before or after in.close(),
>socket.close(), etc). In a function i process a message, where the
>object TH used as an argument. If i put stop() method before proceeding
>a message, then, again, it hangs. If after, evrth works. What's more,
>when u close application, program begin to close resources (i mean lines
>after TH.stop() start to execute).
>
>So, does anybody here knows the answer or just gets some thoughts about
>this problem.
>Thanks 4 yr time and 4 possible answer.
Technical Details
Message-ID: <6tkjja$q705@forums.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <35FC60E9.73D13B3B@collegemail.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: ff01d,9bca7a1d6ef312de
X-Google-Attributes: gidff01d,public
X-Google-Thread: f74b3,9bca7a1d6ef312de
X-Google-Attributes: gidf74b3,public
From: "JRadecki" <jradecki@csi.com>
Subject: Re: Stopping threads...
Date: 1998/09/14
Message-ID: <6tkjja$q705@forums.borland.com>
X-Deja-AN: 391211181
References: <35FC60E9.73D13B3B@collegemail.com>
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4
Organization: Radical Systems
Newsgroups: borland.public.jbuilder.java.language,borland.public.jbuilder.applet-issues