Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #28455
| From | markspace <markspace@nospam.nospam> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: threadpool and ui paint |
| Date | 2014-05-13 09:35 -0700 |
| Organization | A noiseless patient Spider |
| Message-ID | <lkthl3$h9u$1@dont-email.me> (permalink) |
| References | <lkshvd$143g$1@ariadne.rz.tu-clausthal.de> <1hwerxvmc8e0q.9djf9367s6xd$.dlg@40tude.net> |
On 5/13/2014 2:26 AM, Joerg Meier wrote:
> On Tue, 13 May 2014 09:35:09 +0200, Philipp Kraus wrote:
>
>> class worker {
>> void run()
>> {
>>
>> while (threadruns)
>> {
>> for all x = get object from queue
>> {
>> calculate x
>> push x back to the finish queue
> SwingUtilities.invokeLater(new Runnable() {
> public void run() {
> swingJLabelOrWhatever.setText(x);
> }
> });
>> }
However, this is broken if 'x' is mutable. You can't mutate (change)
objects that are being accessed by more than one thread. You'll need to
synchronize 'x', and that can be a lot of hassle. The currency
tutorials barely scratch the surface.
I'm going to go out on a limb here and say M. Kraus isn't going to be
able to do that reliably, based on what we've seen from his posts.
I think M. Kraus is going to need to read the language spec, and get a
book called "Java Concurrency in Practice" by Brian Goetz. After
researching those two thoroughly he might be able to design something
workable.
http://docs.oracle.com/javase/specs/jls/se8/html/jls-17.html
http://jcip.net.s3-website-us-east-1.amazonaws.com/
>> - or here paint x -
>>
>> thread await
>>
>> for all y = ….
>> }
>>
>> }
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
threadpool and ui paint Philipp Kraus <philipp.kraus@flashpixx.de> - 2014-05-13 09:35 +0200
Re: threadpool and ui paint Joerg Meier <joergmmeier@arcor.de> - 2014-05-13 11:26 +0200
Re: threadpool and ui paint markspace <markspace@nospam.nospam> - 2014-05-13 09:35 -0700
Re: threadpool and ui paint Eric Sosman <esosman@comcast-dot-net.invalid> - 2014-05-13 08:10 -0400
Re: threadpool and ui paint markspace <markspace@nospam.nospam> - 2014-05-13 09:45 -0700
Re: threadpool and ui paint Eric Sosman <esosman@comcast-dot-net.invalid> - 2014-05-13 13:22 -0400
Re: threadpool and ui paint markspace <markspace@nospam.nospam> - 2014-05-13 10:46 -0700
csiph-web