Hi Phil,

Yes, the SwingWorker in Swing is similar to the AsyncTask in Android,
but they are "one shot async tasks".

In the other hand, the WebWorker in HTTP5 or Handler in Android, what
they do is to post messages to the message queue of the UI thread.

Regards,
Esteban A. Maringolo


2013/12/2 [email protected] <[email protected]>:
> Same story with Swing UI in Java if you want decent performance.
>
> http://en.wikipedia.org/wiki/SwingWorker
>
> Phil
>
>
>
> On Mon, Dec 2, 2013 at 3:10 PM, Esteban A. Maringolo <[email protected]>
> wrote:
>>
>> 2013/12/2 Yuriy Tymchuk <[email protected]>:
>> > Yes, This is a nice idea, but I was telling about the other thing. It’s
>> > really simple to start a new process in Pharo. Maybe we should introduce
>> > common practices in pharo? When I was following Obj-C course, one of the
>> > fundamental thing that was taught: do time consuming tasks in the other
>> > process. So I want to write a chapter on the concurrent programming in
>> > Pharo, but is question is: am I missing something? Because this looks quite
>> > trivial.
>>
>> Unless you program everything based on callbacks, then even if you
>> fork explicitly  (new Processes) or by means of Futures, Promises,
>> etc... at one point you'll have to wait (it is, block) every time you
>> need to update the UI.
>>
>> The good practice is to spend the least time possible running thing in
>> the UI thread.
>>
>> But given the fact the VM is single process in terms of host OS,
>> callbacks won't provide much resilience either.
>>
>> Regards,
>>
>> Esteban A. Maringolo
>>
>> ps: As an concrete example, Android will kill any process taking more
>> than 5 seconds in the main thread. So EVERYTHING except events,
>> painting and layout, must take less than that, and if you do I/O or
>> computation, you have to use threads.
>> Ref:
>> http://developer.android.com/guide/components/processes-and-threads.html
>>
>

Reply via email to