Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #23999

Re: The invokeLater loop

Path csiph.com!usenet.pasdenom.info!aioe.org!eternal-september.org!feeder.eternal-september.org!mx05.eternal-september.org!.POSTED!not-for-mail
From Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: The invokeLater loop
Date Fri, 10 May 2013 23:50:26 +0200
Organization A noiseless patient Spider
Lines 32
Message-ID <kmjps6$2li$1@dont-email.me> (permalink)
References <invokeLater-loop-20130510204735@ram.dialup.fu-berlin.de> <YJbjt.18$fS4.15@newsfe08.iad> <looping-20130510213759@ram.dialup.fu-berlin.de>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding 8bit
Injection-Date Fri, 10 May 2013 21:46:46 +0000 (UTC)
Injection-Info mx05.eternal-september.org; posting-host="f6ca6bb52c0933e86b8a17e90bd81433"; logging-data="2738"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18qxpRwzQYju3u+bI9t/OqM"
User-Agent Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20130328 Thunderbird/17.0.5
In-Reply-To <looping-20130510213759@ram.dialup.fu-berlin.de>
Cancel-Lock sha1:L6Aq7tZPCVIaVyYApKxTmJ2QsTw=
Xref csiph.com comp.lang.java.programmer:23999

Show key headers only | View raw


On 10/05/2013 21:40, Stefan Ram allegedly wrote:
> Daniel Pitts <newsgroup.nospam@virtualinfinity.net> writes:
>> It is a good way to eat up CPU cycles if you don't want to have your CPU 
>> go idle.  Also known as a laptop warmer.
> 
>   Say, I am writing an implementation of the »Game Of Life«. I have an
>   endless main loop whose contents updates to the next generation.
> 
>   I want to have a sequence like:
> 
>       - calculate next generation
>       - update screen
>       - calculate next generation
>       - update screeen
>       - calculate next generation
>       - ...
> 
>   I think that I can do this by calculating the next generation and
>   updating the screen in »paintComponent« and then »invokingLater«
>   paintComponent or requesting a screen update which indirectly will
>   call »paintComponent« again. This will give the sequence above.

Not sure I get this. If you are performing non-UI-related computations
in your "Object" (I second Daniel's remarks on your choice of
nomenclature, btw), then these will happen on the EDT. But they should
actually be happening /off/ the EDT.

So it seems to me either you are busying the EDT and lagging the app, or
it's really just a laptop warmer. Perhaps another example would be useful.

-- 
DF.

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

The invokeLater loop ram@zedat.fu-berlin.de (Stefan Ram) - 2013-05-10 18:54 +0000
  Re: The invokeLater loop Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2013-05-10 12:18 -0700
    Re: The invokeLater loop Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2013-05-10 14:26 -0700
    Re: The invokeLater loop Joerg Meier <joergmmeier@arcor.de> - 2013-05-10 23:28 +0200
    Re: The invokeLater loop Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-05-10 17:39 -0400
    Re: The invokeLater loop Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2013-05-10 23:50 +0200
  Re: The invokeLater loop markspace <markspace@nospam.nospam> - 2013-05-10 14:51 -0700
  Re: The invokeLater loop Silvio <silvio@internet.com> - 2013-05-11 00:26 +0200
    Re: The invokeLater loop Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2013-05-10 15:52 -0700
  Re: The invokeLater loop Roedy Green <see_website@mindprod.com.invalid> - 2013-05-10 23:27 -0700
    Re: The invokeLater loop "Qu0ll" <Qu0llSixFour@gmail.com> - 2013-05-12 19:44 +1000
  Re: The invokeLater loop Knute Johnson <eternal@knutejohnson.com> - 2014-01-30 20:48 -0800

csiph-web