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


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

Re: The invokeLater loop

From Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: The invokeLater loop
Date 2013-05-10 23:50 +0200
Organization A noiseless patient Spider
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>

Show all headers | 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