]> git.sesse.net Git - nageru/blobdiff - nageru/image_input.h
In ImageInput, make one global update thread instead of one per image.
[nageru] / nageru / image_input.h
index 6a75df48c9f15ccdccfa26fe4a40b70bf49b05dd..ac3c519147d6d4d6f66ad4e2baffaffaabdf7a69 100644 (file)
@@ -36,10 +36,11 @@ private:
 
        static std::shared_ptr<const Image> load_image(const std::string &filename, const std::string &pathname);
        static std::shared_ptr<const Image> load_image_raw(const std::string &pathname);
-       static void update_thread_func(const std::string &filename, const std::string &pathname, const timespec &first_modified);
+       static void update_thread_func();
        static std::mutex all_images_lock;
-       static std::map<std::string, std::shared_ptr<const Image>> all_images;
-       static std::map<std::string, std::thread> update_threads;
+       static std::map<std::string, std::shared_ptr<const Image>> all_images;  // Under all_images_lock.
+       static bool update_thread_started;  // Under all_images_lock.
+       static std::thread update_thread;  // Under all_images_lock.
 
        static std::mutex threads_should_quit_mu;
        static bool threads_should_quit;  // Under threads_should_quit_mu.