[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MiNT] GEM mainloop and time consuming tasks



Hi,

On maanantai 28 tammikuu 2013, Miro Kropáček wrote:
> I know there's a lot of GEM wizards out there, so I'd like to ask this
> slightly off topic question. How is programmer supposed to fight with
> heavy operations like loading and analyzing hundreds of files? From Qt
> and .net I'm used to the UI thread, events, signals but what about the
> poor Atari world? Is there a way how to not freeze all dialogs? I mean
> except the obvious things like calling refresh from the other loop after
> each iteration or calling each iteration from the UI mainloop.

That's also how it's often done with Qt as (I think) all UI operations
need to be done from the main thread and one of course needs to know
which Qt classes are thread-safe, re-entrant etc.

Besides, MiNT supports threads, so one might consider putting IO to
threads also on MiNT.  Just note that MiNT thread stack is much
more seriously constrained than on systems with virtual memory,
it has some additional gotchas (see "pthreads" ml-thread in 2011)
and I don't know how thread safe MiNTlib functions are (starting
from malloc).

If there's not huge amounts of data to communicate, you could also
consider a helper/background process.


Personally, I would just split the task to small enough pieces
so that UI can be updated often enough, unless there are
operations that can "normally" take very long time (e.g.
network timeout is half a minute by default, isn't it).


	- Eero