diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/AsyncImageLoader.hpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/include/AsyncImageLoader.hpp b/include/AsyncImageLoader.hpp index 77fd5b4..94b225d 100644 --- a/include/AsyncImageLoader.hpp +++ b/include/AsyncImageLoader.hpp @@ -54,6 +54,15 @@ namespace QuickMedia { // Note: this method is not thread-safe void update(); private: + struct Download { + ReadProgram read_program; + int64_t download_start = 0; + Path thumbnail_path; + std::shared_ptr<ThumbnailData> thumbnail_data; + sf::Vector2i resize_target_size; + std::string url; + }; + AsyncImageLoader(); ~AsyncImageLoader(); AsyncImageLoader(AsyncImageLoader &other) = delete; @@ -65,16 +74,9 @@ namespace QuickMedia { // Returns -1 if all threads are busy int get_free_load_index() const; - private: - struct Download { - ReadProgram read_program; - int64_t download_start = 0; - Path thumbnail_path; - std::shared_ptr<ThumbnailData> thumbnail_data; - sf::Vector2i resize_target_size; - std::string url; - }; + void reset_download(Download &download); + private: std::mutex download_mutex; // TODO: Use curl single-threaded multi-download feature instead Download downloads[NUM_IMAGE_LOAD_PARALLEL]; |