πŸš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.api
Article #1933

Re: Programming Threads

#1933
From: Joi Ellis [TeamB]
Date: Thu, 12 Jul 2001 14:11
21 lines
1737 bytes
"SοΏ½ren Hanisch" <soeren.hanisch@gwi-ag.com> wrote:
> Hi there,

> how can I interrupt a thread by clicking on a Button and resuming it when
> clicken another Button.
> I know, that there is a method "interrupt()" - I guess this will interrupt
> the thread, but how can I resume it at the same position ?
> I do also know that the method "resume()" is deprecated.
> Can anybody tell me how to solve this problem in right way ?

Have the thread's run() method check a boolean, call it 'mustPause' or
something.  Have the button toggle the value of mustPause.  The run
thread must still be running but it need not be doing any useful work
beyond sleeping or waiting.


-- 
Joi Ellis (TeamB)               http://www.teamb.com/
No direct email, please.
For best results, post on news server newsgroups.borland.com!
Newsgroup Info: http://www.borland.com/newsgroups/guide.html
Technical Details
Message-ID: <3b4db029$1_2@dnews>
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnews!not-for-mail
References: <3b4d9294@news.gwi-ag.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 1089d0,df9256bde7b56add
X-Google-Attributes: gid1089d0,public
X-Google-ArrivalTime: 2001-07-12 07:16:52 PST
Message-ID: <3b4db029$1_2@dnews>
From: "Joi Ellis [TeamB]" <joi@aravox.com>
Subject: Re: Programming Threads
Newsgroups: borland.public.jbuilder.java.api
References: <3b4d9294@news.gwi-ag.com>
User-Agent: tin/1.4.2-20000205 ("Possession") (UNIX) (Linux/2.2.16-3 (i686))
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
NNTP-Posting-Host: 209.46.41.66
Date: 12 Jul 2001 07:11:54 -0700
X-Trace: dnews 994947114 209.46.41.66 (12 Jul 2001 07:11:54 -0700)
Lines: 21
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnews!not-for-mail