On 06/18/2014 11:20 AM, cutey Love wrote:
> I'm trying to read in 100000 lines of text, use some functions to
> edit them and then return a new list.
> The problem is my program always goes not responding when the amount
> of lines are a high number.
> I don't care how long the program takes to work, just need it to stop
> crashing?

Welcome to the world of GUI programming. GUI programs are event-driven.
 When an event happens your code runs to handle the event.  While you
are handling an event, the rest of the GUI cannot run, until you return
control to the main loop.  So when you have to do long-running tasks,
you need to find a way to return control to the main loop while your
work continues.  There are basically two ways to do this. One is to
spawn a thread to do the work, the other is to use asynchronous
programming, depending on what you need to get done.  The problem with
threads is that you cannot directly make GUI calls. Instead you have to
set up a message queue of some sort, or maybe use flag variables, and
then have a callback that fires periodically, regularly with a some kind
of clock, or during the idle portion.

Anyway your question is light on details, so my replay is rather light.
 Hopefully you are now pointed in the right direction for asking
questions at least.  A quick google search reveals this which is pretty
much the sort of thing you wish to do:



Reply via email to