Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #28455
| Path | csiph.com!usenet.pasdenom.info!aioe.org!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | markspace <markspace@nospam.nospam> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: threadpool and ui paint |
| Date | Tue, 13 May 2014 09:35:45 -0700 |
| Organization | A noiseless patient Spider |
| Lines | 46 |
| Message-ID | <lkthl3$h9u$1@dont-email.me> (permalink) |
| References | <lkshvd$143g$1@ariadne.rz.tu-clausthal.de> <1hwerxvmc8e0q.9djf9367s6xd$.dlg@40tude.net> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=Big5 |
| Content-Transfer-Encoding | 8bit |
| Injection-Date | Tue, 13 May 2014 16:35:47 +0000 (UTC) |
| Injection-Info | mx05.eternal-september.org; posting-host="9358cda03e1e0dfd3c4b757daa608707"; logging-data="17726"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/3wcmoqZnAhZOklSHtZMRZOfSHr2+aFtw=" |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 |
| In-Reply-To | <1hwerxvmc8e0q.9djf9367s6xd$.dlg@40tude.net> |
| Cancel-Lock | sha1:HXQqtmD/pUWUKGpviJcC1LZlrF8= |
| Xref | csiph.com comp.lang.java.programmer:28455 |
Show key headers only | View raw
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