gtk app with threads



Hello

I'm creating an application which will download several large files. I've setup a progress bar to display during the download and I wish to keep it updated and not freeze the app display. I suppose threads are the obvious choice and I've created a separate thread to download the packages.

I suppose that I shouldn't mess with widgets from the second thread since I've already caused several errors to come up working that way and I'm currently attempting to install an idle handler on the main thread to update the display.

Problem is, the idle thread doesn't ever get called. I'm creating it as such:

   Glib->idle_add (sub { $self->update_progress (\$downloaded) });

Where $downloaded is a shared variable.

Does anyone here have experience with this type of problem? How would you recommend solving this particular design problem?

Thanks in advance,

Cristovao Dalla Costa.




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