Re: How to handle long I/O operations



On Mon, Aug 13, 2001 at 02:05:10PM -0700 Tara M wrote:

There's no reason to use threading, atleast it won't be an advantage
on your case.

Let me give you an example, maybe that'll clarify the situation.
First lets say your situation is to load a BIG 100 MB file on
a 100 MB slow media (say a 100 MB floppy).

This would take a long time right? so not only will you want to
use a progress bar, but you'll probably want o manage GTK+ resources
or your own resources in the mean time. So set up your
program as follows:
[code snip]

The disadvantage of this solutions is:
* if the working callback needs more time than you have specified for the
  gtk timeout then your application will freeze.
* if the working callback needs (much) less time than you have specified
  then the implementation is not efficient.

I have implemented such a thing to move files from one location to another.
It simply uses the gtk_idle_add function. The only difference is that the
working function is not called every X mseconds but if there is time to do
that.

Markus.




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