jklmli / manga_downloader

Cross-platform, multi-site, multi-threaded manga downloader with over 5000 distinct mangas. Includes support for automated downloading via external .xml file and conversion for viewing on the Kindle.
MIT License
270 stars 53 forks source link

progressBar not thread-safe #15

Closed jklmli closed 13 years ago

jklmli commented 13 years ago

Functionality is broken whenever multiple threads are running. It appears to hang forever at 0% progress, although downloading is still taking place in the background.

--verbose usage appears to be mandatory right now

spikepmw commented 13 years ago

The use of the progress bar was implemented to be thread safe. I suspect the problem you are seeing is actually some form of deadlock. I have not seen this issue. I can help you debug it but obviously without seeing the issue I am not much help.

First question does the chapter that is hung ever finish downloading?

jklmli commented 13 years ago

The problem was that I was downloading using 80 threads, and thus no progress was made. I had assumed that 80 separate download bars would be outputted, so I assumed that a single download bar of 0% implied that it had broken. My mistake.

spikepmw commented 13 years ago

No I implemented it where only one bar is shown at a time. I believe that is the best behavior. Showing mutliple causes each to overwrite the other making hard to see the progress of any of them.

I implemented the chapter download they would try for the display lock and if they failed they would continue to download. If they finished download before they got the display lock, then they would wait until they receive the lock. Which is why when one completes, x (x being the number of chapter download threads) also complete

jklmli commented 13 years ago

This is a good solution. I'll try to see if I can somehow figure out how to get multiple download bars working.