Re: What to return in async transfer callbacks?



On Mon, 2005-10-10 at 17:52 +0200, Matthias Kaeppler wrote:
> Alexander Larsson wrote:
> > If you're copying a directory with a million small files in it, then
> > progress_sync_callback will be called a million times, with the source
> > and target filename for each file. progress_update_callback however,
> > will at most be called every 100 msecs for progress updates. Both are
> > called when you need user interaction, but its better to use the async
> > one.
> Well, if not more than 1 file is copied every 100ms (which seems to be 
> very unlikely to me), the update-callback is in fact the one which is 
> called WAY more often, and should be the faster one, right? ^^
> 
> For example, when copying a file which is sized e.g. 100MB, the sync 
> callback would only be called before and after the transfer (if I got 
> that part right), but the update callback would be called probably 
> thousands of times.

Yes, that is true. However, in such a case you typically want to update
the progress bar multiple times per file. :)

> Still, I am not sure about whether I was right with the confused 
> parameters. Can you really confirm that? After reading the nautilus 
> source code (or the relevant parts), it looks as if they are passing the 
> arguments in the order specified by the documentation I claimed to be 
> wrong (because it didn't work for me). In other words, I'm not so sure 
> afterall if I was right with that observation, since it seems to work 
> for the nautilus guys.
> 
> I'm really confused now.

I'm not sure exactly what you are asking here, or if you're asking
something. The important thing to know is:
* sync callback gets called for every little file operation, and is
mainly used to figure out what happened for every file (at least that is
what nautilus uses it for)
* async callbacks are called "periodically" and are useful for progress
dialogs.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Alexander Larsson                                            Red Hat, Inc 
                   alexl redhat com    alla lysator liu se 
He's an unconventional guerilla barbarian with a mysterious suitcase 
handcuffed to his arm. She's an enchanted blonde stripper from beyond the 
grave. They fight crime! 




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